def post(self, sRedirectPath=''): username = self.request.get('username') password = self.request.get('password') user = User.login(username, password) if user: cookie_val = make_secure_val(str(user.key().id())) self.response.headers.add_header( 'Set-Cookie', '%s=%s; Path=/' % ('user_id', cookie_val)) self.redirect(sRedirectPath) else: msg = 'Invalid login' self.write_form('', msg)
def post(self,sRedirectPath=''): username = self.request.get('username') password = self.request.get('password') user = User.login(username,password) if user: cookie_val = make_secure_val(str(user.key().id())) self.response.headers.add_header( 'Set-Cookie', '%s=%s; Path=/' % ('user_id', cookie_val)) self.redirect(sRedirectPath) else: msg = 'Invalid login' self.write_form('',msg)
def post(self, sRedirectPath=''): errorUser = errorPassword = errorVerify = errorEmail = '' username = self.request.get('username') password = self.request.get('password') verify = self.request.get('verify') email = self.request.get('email') has_error = False if not valid_username(username): errorUser = '******'s not a valid username.' has_error = True if not valid_password(password): errorPassword = '******'t a valid password.' has_error = True elif password != verify: errorVerify = 'Your passwords didn\'t match.' has_error = True if not valid_email(email): errorEmail = 'That\'s not a valid email.' has_error = True if has_error: password = '' verify = '' self.write_form(username, password, verify, email, errorUser, errorPassword, errorVerify, errorEmail) else: u = User.by_name(username) if u: errorUser = '******' self.write_form(username, password, verify, email, errorUser, errorPassword, errorVerify, errorEmail) else: u = User.register(username, password, email) u.put() cookie_val = make_secure_val(str(u.key().id())) self.response.headers.add_header( 'Set-Cookie', '%s=%s; Path=/' % ('user_id', cookie_val)) self.redirect(sRedirectPath)
def post(self,sRedirectPath=''): errorUser = errorPassword = errorVerify = errorEmail = '' username = self.request.get('username') password = self.request.get('password') verify = self.request.get('verify') email = self.request.get('email') has_error = False if not valid_username(username): errorUser = '******'s not a valid username.' has_error = True if not valid_password(password): errorPassword = '******'t a valid password.' has_error = True elif password != verify: errorVerify = 'Your passwords didn\'t match.' has_error = True if not valid_email(email): errorEmail = 'That\'s not a valid email.' has_error = True if has_error: password = '' verify = '' self.write_form(username,password,verify,email,errorUser,errorPassword,errorVerify,errorEmail) else: u = User.by_name(username) if u: errorUser = '******' self.write_form(username,password,verify,email,errorUser,errorPassword,errorVerify,errorEmail) else: u = User.register(username,password,email) u.put() cookie_val = make_secure_val(str(u.key().id())) self.response.headers.add_header( 'Set-Cookie', '%s=%s; Path=/' % ('user_id', cookie_val)) self.redirect(sRedirectPath)