Exemplo n.º 1
0
 def test_check_user(self):
     res = check_user('1881054126', 'wang')
     self.assertEqual(res, False)
     res = check_user('18810541263', '0603')
     self.assertEqual(res, True)
     res = check_user('18810541263', '11')
     self.assertEqual(res, False)
Exemplo n.º 2
0
 def test_check_user(self):
     res = check_user('1881054126','wang')
     self.assertEqual(res,False)
     res = check_user('18810541263','0603')
     self.assertEqual(res,True)
     res = check_user('18810541263','11')
     self.assertEqual(res,False)
Exemplo n.º 3
0
 def post(self, *args, **kwargs):
     '''
     1.0版本不通过outh 认证,通过查询数据库
     :param args:
     :param kwargs:
     :return:
     '''
     #print u'called'
     account = self.get_argument("account")
     passw = self.get_argument("passw")
     account = account.strip()
     passw = passw.strip()
     if passw=='' or account =='':
         self.render("login_fail.html")
     else:
         res=check_user(account,passw)
         if res:
             self.set_secure_cookie("username",account)
             self.set_secure_cookie("user_id",unicode(res))
             self.redirect('/')
         else:
             self.render("login_fail.html")
Exemplo n.º 4
0
 def post(self, *args, **kwargs):
     '''
     1.0版本不通过outh 认证,通过查询数据库
     :param args:
     :param kwargs:
     :return:
     '''
     #print u'called'
     account = self.get_argument("account")
     passw = self.get_argument("passw")
     account = account.strip()
     passw = passw.strip()
     if passw == '' or account == '':
         self.render("login_fail.html")
     else:
         res = check_user(account, passw)
         if res:
             self.set_secure_cookie("username", account)
             self.set_secure_cookie("user_id", unicode(res))
             self.redirect('/')
         else:
             self.render("login_fail.html")