Пример #1
0
 public function testUserCanRetryLoginWithoutNewToken()
 {
     // purpose of this test is for ajax submited login forms .. user will still have old token
     // by default phalcon destorys the token in the session if the check passes
     // we need to insure user can try a different password
     $this->auth->newUser('tempcke', 'P@ssW0rd', '*****@*****.**');
     $token = $this->auth->getTokenElement();
     $_POST[$this->auth->tokenkey] = $this->auth->tokenval;
     try {
         $this->auth->login('tempcke', 'WrongPassword');
     } catch (\Logikos\Auth\Password\Exception $e) {
         $this->auth->login('tempcke', 'P@ssW0rd');
     }
     $this->assertTrue($this->auth->isLoggedIn(), 'User should be logged in after entering the wrong password then the right password');
 }