Example #1
0
 /**
  * Performs an authentication attempt
  *
  * @throws Zend_Auth_Adapter_Exception If authentication cannot be performed.
  * @return Zend_Auth_Result
  */
 public function authenticate()
 {
     // Try to get the account information
     try {
         $account = new Opus_Account(null, null, $this->_login);
     } catch (Exception $ex) {
         return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND, $this->_login, array('auth_error_invalid_credentials'));
     }
     // Check if password is correcct, but for old hashes.  Neede for
     // migrating md5-hashed passwords to SHA1-hashes.
     if ($account->isPasswordCorrectOldHash($this->_password) === true) {
         Zend_Registry::get('Zend_Log')->warn('Migrating old password-hash for user: '******'auth_login_success'));
     }
     return new Zend_Auth_Result(Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID, $this->_login, array('auth_error_invalid_credentials'));
 }
 /**
  * Test modifying account information.
  */
 public function testChangePasswordSuccessWithSpecialChars()
 {
     $config = Zend_Registry::get('Zend_Config');
     $config->account->editOwnAccount = 1;
     $this->loginUser('john', 'testpwd');
     $this->request->setMethod('POST')->setPost(array('username' => 'john', 'firstname' => '', 'lastname' => '', 'email' => '', 'password' => 'new@pwd$%', 'confirm' => 'new@pwd$%'));
     $this->dispatch('/account/index/save');
     $this->assertRedirect();
     // Check if change succeeded...
     $account = new Opus_Account(null, null, 'john');
     $this->assertTrue($account->isPasswordCorrect('new@pwd$%'));
     $this->assertNotContains('<ul class="errors">', $this->getResponse()->getBody());
 }