예제 #1
0
 /**
  * Checks the user credentials
  *
  * @param array $credentials
  * @return boolan
  */
 public function check($credentials)
 {
     // Check if the user exist
     $user = Feusers::findFirstByUsername($credentials['username']);
     if ($user == false) {
         $this->registerUserThrottling(0);
         throw new Exception('Wrong email/password combination');
     }
     // Check the password
     //$this->security->checkHash($credentials['password'], $user->password)
     if ($this->checkPassword($user->password, $credentials['password'])) {
         $this->_registerSession($user);
         $this->flashSession->success(controllerBase::translate('welcome') . ' ' . $user->username);
         //Forward to the 'invoices' controller if the user is valid
         // 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->createRememberEnviroment($user);
         }
         $this->response->redirect("");
         $this->view->disable();
     } else {
         $this->registerUserThrottling($user->uid);
         $this->flash->error('Wrong email/password');
         //throw new Exception('Wrong email/password combination');
     }
 }