def old_login(request): data={'msg':'','project_name':'Kunkka'} data["oauth_url"]=auth_uri print request.session if request.method=="POST": username=request.POST["username"] password=request.POST["password"] user=check_user(username,password) if user: request.session["username"]=user.username #headers = remember(request, username) return HTTPFound(location="/") else: data['msg']='Invalid Login Id and password' else: log(request.session) return data
def auth(self,user,password): user=check_user(self.session,user,password) if user is None: return False self._user=user return True
def auth(self, user, password): user = check_user(self.session, user, password) if user is None: return False self._user = user return True
def authentication_check(usr, pas): #username password authentication if authentication.check_user(usr, pas) == True: return ("1") else: return ("0")
def test_create_user_update_admin(self): u=auth.get_user(self.s,'admin') self.assertTrue(auth.create_user(self.s,'test','pass2',None,u)) u=auth.check_user(self.s,'test','pass2') self.assertIsNotNone(u)
def test_create_user_update_other(self): u=auth.get_user(self.s,'test_1') self.assertFalse(auth.create_user(self.s,'test','pass2',None,u)) u=auth.check_user(self.s,'test','pass') self.assertIsNotNone(u)
def test_create_user_update_no_creator(self): self.assertFalse(auth.create_user(self.s,'test','pass2',None,None)) u=auth.check_user(self.s,'test','pass') self.assertIsNotNone(u)
def test_check_user_success(self): u=auth.check_user(self.s,'test','pass') self.assertEqual(u.name,'test') self.assertNotEqual(u.password,'PUQNajhroe$6068b411a6f27821dc9473b8a26b7813b22ebcd7')
def test_check_user_fail(self): u=auth.check_user(self.s,'test','test1') self.assertIsNone(u)