Beispiel #1
0
 /**
  * Checks the user credentials
  *
  * @param  array $credentials
  * @return boolan
  */
 public function check($credentials)
 {
     // Check if the user exist
     $user = Users::findByEmailOrUsername($credentials['email']);
     if (!$user) {
         $this->registerUserThrottling(0);
         $this->flashSession->error(t('Wrong email/password combination!'));
         return $this->response->redirect('login');
     }
     // Check the password
     if (!$this->security->checkHash($credentials['password'], $user->getPasswd())) {
         //$this->registerUserThrottling($user->id);
         $this->flashSession->error(t('Wrong email/password combination!'));
         return $this->response->redirect('login');
     }
     // Check if the user was flagged
     $this->checkUserFlags($user);
     // Register the successful login
     $this->saveSuccessLogin($user);
     // Check if the remember me was selected
     if (isset($credentials['remember'])) {
         $this->setRememberEnviroment($user);
     }
     $this->setSession($user);
     return $this->response->redirect();
 }