Esempio n. 1
0
 def post(self):
     nickname = self.request.get('nickname')
     email = self.request.get('email')
     password = self.request.get('password')
     password2 = self.request.get('password2')
     if password2 != password:
         self.session.start(None)
         self.session['flash_msg'] = '<p>Password fields did not match.</p>'
         self.redirect('/signup')
         return
     user = User.get_or_insert(nickname=nickname,
                               email=email,
                               pwd=salt_n_hash(password),
                               key_name=nickname)
     self.session.start(None)
     if not User.authenticate(nickname, password):
         self.session[
             'flash_msg'] = '<p>Sorry, the nickname you chose is already taken.</p>'
         self.redirect(self.request.url)
         return
     id = signup_id(nickname)
     signup = UserSignup(user=user, key_name=id)
     signup.put()
     confirm_url = self.request.relative_url('confirmsignup?id=' + id)
     logging.info("user:"******" password:"******" confirm_url:" + confirm_url)
     from google.appengine.api import mail
     #sender = 'Registrar <*****@*****.**>'
     sender = '*****@*****.**'
     subject = 'Confirm your registration'
     body = \
         'Hello %s,\n\n' % nickname + \
         'To confirm your registration, please visit the link below:\n\n' + \
         '<%s>\n' % confirm_url
     mail.send_mail(sender, email, subject, body)
     self.session['flash_msg'] = \
         '<p>Thank you for signing up, %s! A confirmation ' % nickname + \
         'message is on its way to your email inbox. It will contain a link ' + \
         'which you will need to visit in order to complete your registration.</p>' + \
         '<p>See you soon!</p>'
     self.redirect('/')
Esempio n. 2
0
	def get(self):
		id = self.request.get('id')
		signup = UserSignup.get_by_key_name(id)
		if not signup:
			self.error(401)
			return
		user = signup.user
		user.suspended = False
		user.put()
		signup.delete()
		self.session.start(user)
		self.session['flash_msg'] = '<p>Your account has been confirmed.</p>'
		self.redirect('/user/' + user.nickname)
Esempio n. 3
0
 def post(self):
     nickname = self.request.get('nickname')
     email = self.request.get('email')
     password = self.request.get('password')
     password2 = self.request.get('password2')
     if password2 != password:
         self.session.start(None)
         self.session[ 'flash_msg' ] = '<p>Password fields did not match.</p>'
         self.redirect('/signup')
         return
     user = User.get_or_insert(nickname=nickname,
                 email=email,
                 pwd=salt_n_hash(password),
                 key_name=nickname)
     self.session.start(None)
     if not User.authenticate(nickname, password):
         self.session[ 'flash_msg' ] = '<p>Sorry, the nickname you chose is already taken.</p>'
         self.redirect(self.request.url)
         return
     id = signup_id(nickname)
     signup = UserSignup(user=user, key_name=id)
     signup.put()
     confirm_url = self.request.relative_url('confirmsignup?id='+id)
     logging.info("user:"******" password:"******" confirm_url:" +confirm_url)
     from google.appengine.api import mail
     #sender = 'Registrar <*****@*****.**>'
     sender = '*****@*****.**'
     subject = 'Confirm your registration'
     body = \
         'Hello %s,\n\n' % nickname + \
         'To confirm your registration, please visit the link below:\n\n' + \
         '<%s>\n' % confirm_url
     mail.send_mail( sender, email, subject, body )
     self.session['flash_msg'] = \
         '<p>Thank you for signing up, %s! A confirmation ' % nickname + \
         'message is on its way to your email inbox. It will contain a link ' + \
         'which you will need to visit in order to complete your registration.</p>' + \
         '<p>See you soon!</p>'
     self.redirect('/')
Esempio n. 4
0
 def get(self):
     id = self.request.get('id')
     signup = UserSignup.get_by_key_name(id)
     if not signup:
         self.error(401)
         return
     user = signup.user
     user.suspended = False
     user.put()
     signup.delete()
     self.session.start(user)
     self.session['flash_msg'] = '<p>Your account has been confirmed.</p>'
     self.redirect('/user/' + user.nickname)