Esempio n. 1
0
 /**
  * Authentica usuario contra la base de datos (especificada en el objeto $authService) (BCrypt)
  * @param type $user
  * @param type $pass
  * @param AuthenticationService $authService
  * @return type bool
  */
 public static function authenticateUser($user, $pass, AuthenticationService $authService)
 {
     $authService->getAdapter()->setIdentity($user)->setCredential($pass);
     $result = $authService->authenticate();
     return $result;
 }
 private function authenticate(AuthenticationMethod $authentication, $autoconnect)
 {
     $user_id = AuthenticationService::authenticate($authentication, $autoconnect);
     $current_user = CurrentUser::from_session();
     if ($user_id && $this->maintain_config->is_under_maintenance() && !$current_user->check_auth($this->maintain_config->get_auth(), MaintenanceConfig::ACCESS_WHEN_MAINTAIN_ENABLED_AUTHORIZATIONS)) {
         $session = AppContext::get_session();
         Session::delete($session);
         $this->view->put('ERROR_MESSAGE', MessageHelper::display(LangLoader::get_message('user.not_authorized_during_maintain', 'status-messages-common'), MessageHelper::NOTICE));
         $this->has_error = true;
     } else {
         if ($user_id) {
             AppContext::get_response()->redirect($this->get_redirect_url());
         }
         if ($authentication->has_error()) {
             $this->view->put('ERROR_MESSAGE', MessageHelper::display($authentication->get_error_msg(), MessageHelper::NOTICE));
             $this->has_error = true;
         }
     }
 }