/**
  * @param string $currentPassword
  * @throws Exception
  */
 private function ValidateCurrentPassword($currentPassword)
 {
     $errorMessage = '';
     if (!$this->identityCheckStrategy->CheckUsernameAndPassword($this->app->GetUserAuthorizationStrategy()->GetCurrentUser(), $currentPassword, $errorMessage)) {
         throw new Exception(GetCaptions('UTF-8')->GetMessageString('UsernamePasswordWasInvalid'));
     }
 }
 public function SaveUserIdentity(UserIdentity $identity)
 {
     $identity->encryptedPassword = $this->identityCheckStrategy->GetEncryptedPassword($identity->password);
     $this->sessionWrapper->setValue(self::KEY_SESSION_IDENTITY, $identity);
     if ($identity->persistent) {
         setcookie(self::KEY_REMEMBER_ME, $this->rememberMeGenerator->encode($identity), time() + self::REMEMBER_ME_LIFETIME);
     }
 }
Exemplo n.º 3
0
Arquivo: login.php Projeto: jsrxar/dto
 public function CheckUsernameAndPassword($username, $password, &$errorMessage) {
     try {
         $result = $this->identityCheckStrategy->CheckUsernameAndPassword($username, $password, $errorMessage);
         if (!$result) {
             $errorMessage = $this->captions->GetMessageString('UsernamePasswordWasInvalid');
         }
         return $result;
     } catch (Exception $e) {
         $errorMessage = $e->getMessage();
         return false;
     }
 }
 /**
  * @param string $plainPassword
  * @param int $expire
  */
 private function SetPasswordCookieEncrypted($plainPassword, $expire)
 {
     setcookie(self::passwordCookie, $this->identityCheckStrategy->GetEncryptedPassword($plainPassword), $expire);
 }