예제 #1
0
 protected function _getPasswordlessModel()
 {
     $authPwlessModel = new Model_AuthPasswordless();
     $userModel = new Model_User();
     $userConditions = $userModel->select()->from($userModel->getName(), Garp_Auth::getInstance()->getSessionColumns());
     $authPwlessModel->bindModel('Model_User', array('conditions' => $userConditions, 'rule' => 'User'));
     return $authPwlessModel;
 }
예제 #2
0
 public function testShouldFailOnStrangersToken()
 {
     if (!$this->_testsEnabled) {
         return;
     }
     $userModel = new Model_User();
     $userModel->insert(array('email' => '*****@*****.**', 'id' => 1));
     $userModel->insert(array('email' => '*****@*****.**', 'id' => 2));
     $authModel = new Model_AuthPasswordless();
     $authModel->insert(array('token' => '12345', 'token_expiration_date' => date('Y-m-d H:i:s', strtotime('+30 minutes')), 'user_id' => 2));
     $pwless = new Garp_Auth_Adapter_Passwordless();
     $response = $pwless->acceptToken('12345', 1);
     $this->assertFalse($response);
     $this->assertEquals($pwless->getErrors(), array(__('passwordless token not found')));
 }