Ejemplo n.º 1
0
 def post(self):
     username=self.request.get('username')
     password=self.request.get('password')
     code=self.request.get('code','')
     codename=self.request.get('codename','')
     codestr=memcache.get(codename)
     success=False
     msg=u''
     if username and password:
         if codestr!=code:
             msg=u'验证码不正确'
         else:
             userlist=UserJoke.all().filter('username ='******'密码错误'
             else:
                 msg=u'用户名不存在'
     else:
         msg=u'用户名、密码不能为空'
     if success:
         self.redirect('/joke/success?do=login')
     html=self.obj2str('templates/login.html',{'uuidstr':str(uuid.uuid4()),'msg':msg,'username':username,'password':password})
     self.flashhtml(html)
Ejemplo n.º 2
0
 def post(self):
     username=self.request.get('username')
     password=self.request.get('password')
     r_password=self.request.get('r_password')
     nickname=self.request.get('nickname')
     code=self.request.get('code','')
     codename=self.request.get('codename','')
     codestr=memcache.get(codename)
     success=False
     msg=u''
     if username and password and r_password and nickname and len(nickname)>2 and len(username)>5 and len(password)>6:
         if password!=r_password:
             msg=u'密码和确认密码不一致'
         else:
             if codestr!=code:
                 msg=u'验证码不正确'
             else:
                 userlist=UserJoke.all().filter('username ='******'用户名已经存在'
     else:
         msg=u'用户名、密码、确认密码、昵称不能为空'
     if success:
         self.redirect('/joke/success?do=reg')
     html=self.obj2str('templates/reg.html',{'uuidstr':str(uuid.uuid4()),'msg':msg,'username':username,'password':password,'nickname':nickname,'r_password':r_password})
     self.flashhtml(html)