def post(self): username = self.request.get('username') password = self.request.get('password') verify = self.request.get('verify') email = self.request.get('email') self.param = dict(username=username, email=email, signup_dest='/mywiki/signup') if self.valid_input(username, password, verify, email): # Generate hash strings hash_pw = webhash.gen_hash_pw(password, SECRET) hash_cookie = webhash.gen_hash_cookie(username, hash_pw, salt='') # Store username/password into database new_user = UserProfile(name=username, password=hash_pw) new_user.put() # Set Cookie self.response.set_cookie('name', value=hash_cookie, path='/') # Redirect to welcome page time.sleep(1) self.redirect('/mywiki') else: self.render('signup.html', **self.param)
def post(self): username = self.request.get('username') password = self.request.get('password') self.param = dict(username=username, password=password) user_list = UserProfile.all() for user in user_list: if username==user.name: if webhash.gen_hash_pw(password, SECRET)!=user.password: self.param['err_password'] = "******" self.render('login.html', **self.param) else: self.redirect('/mywiki') break else: self.param['err_username'] = "******" self.render('login.html', **self.param)