示例#1
0
	def get(self):
		session = get_current_session()
		if session['account'] is None:
			self.redirect('/login')
		else:
			path = os.path.join(os.path.dirname(__file__), '../templates/account.html')
			self.response.out.write(template.render(path,{'data':{'account':session['account']}}))
示例#2
0
	def post(self):
		required = ['email','password']
		if application.required(required,self.request):
			account = accounts.Account.get_by_key_name(self.request.get('email'))
			if account is not None and account.check_password(self.request.get('password')):
				session = get_current_session()
				session.regenerate_id()
				session['account'] = account
				self.redirect('/account')
			else:
				Login.get(self)
示例#3
0
	def post(self):
		from hashlib import sha256
		required = ['email','password','password_confirm']
		if application.required(required,self.request) and self.request.get('password') == self.request.get('password_confirm'):
			exist_account = accounts.Account.get_by_key_name(self.request.get('email'))
			if exist_account is None:
				account = accounts.Account.new(key_name = self.request.get('email'), email=self.request.get('email'),password=self.request.get('password'))
				account.put()
				session = get_current_session()
				session.regenerate_id()
				session['account'] = account
				self.redirect('/account')
			else:
				Register.get(self)
		else:
			Register.get(self)
示例#4
0
	def get(self):
		session = get_current_session()
		session.terminate()
		self.redirect('/')