Пример #1
0
 /**
  * @param   string $identity    - email address
  * @param   mixed  $credentials - e.g. password string
  *
  * @return  \Cms\Access\Auth\Result
  */
 public function checkLogin($identity, $credentials)
 {
     if (is_null($identity) || is_null($credentials) || !is_string($credentials)) {
         return null;
     }
     try {
         // get user object
         $userBusiness = new User('User');
         $user = $userBusiness->getByEmail($identity);
         // check credentials
         $ph = new PasswordHasher();
         if (!$ph->validate($credentials, $user->getPassword())) {
             return null;
         }
         // create auth result and return it
         return $this->createSuccessAuthResult($user);
     } catch (\Exception $e) {
         Registry::getLogger()->logException(__METHOD__, __LINE__, $e, \Seitenbau\Log::DEBUG);
         return null;
     }
 }