示例#1
0
文件: forgot.php 项目: gudwin/extasy
 protected static function validateLoginAttempts($email)
 {
     try {
         UsersLogin::testLoginAttempts();
     } catch (\Extasy\Users\login\LoginAttemptsException $e) {
         try {
             $user = self::lookForEmail($email);
             $e->blockUser(new UserAccount($user));
             throw $e;
         } catch (\NotFoundException $e) {
         }
     }
 }
示例#2
0
文件: login.php 项目: gudwin/extasy
 public static function login($login, $password, $remember = false)
 {
     CMSLog::addMessage(self::LogName, sprintf('Login attempt into "%s"', $login));
     try {
         UsersLogin::testLoginAttempts();
     } catch (\Extasy\Users\login\LoginAttemptsException $e) {
         CMSLog::addMessage(__CLASS__, sprintf('Login attempts limit exceeded'));
         CMSLog::addMessage(__CLASS__, $e);
         try {
             $user = UserAccount::getByLogin($login);
             $e->blockUser($user);
             throw $e;
         } catch (\NotFoundException $e) {
         }
         return;
     }
     try {
         $user = UserAccount::getByLogin($login);
         self::isAuthPassed($user, $password);
         \Extasy\Users\login\LoginAttempt::quickRegister($user, true);
     } catch (\Exception $e) {
         \Extasy\Users\login\LoginAttempt::quickRegister(!empty($user) ? $user : null, false);
         throw $e;
     }
     self::testConfirmationCode($user);
     $user->updateLastActivityDate();
     // write to session login
     self::setupSession($user->getData(), $remember);
     //
     self::$currentUser = $user;
     //
     CMSLog::addMessage(self::LogName, sprintf('User identified as "%s"', $login));
     // Вызываем обработку события, на вход в каждый перехватчик передается текущий объект пользователя
     EventController::callEvent('users_after_login', $user);
 }