Example #1
0
 def POST(self):
     xinput = web.input()
     email = xinput.email if xinput.has_key('email') else None
     password =  xinput.password if xinput.has_key('password') else None
     if email is None or password is None: pass
     t_user = find_one(user, {'email': email})
     if t_user is None:
         return page_front.login(input_email = email, errors={'email': r.er_EmailNotFound})
     mypwd = hash_pwd(password,t_user.salt.zval)
     print(mypwd, t_user.password.zval)
     if mypwd == t_user.password.zval:
         if xinput.has_key('backto'):
             raise web.seeother(xinput.backto)
         else:
             raise web.seeother('/')
     else:
         return page_front.login(input_email = email, errors={'password': r.er_PasswordIsWrong})
Example #2
0
 def GET(self):
     return page_front.login(input_email='', errors = {})