Exemplo n.º 1
0
 /**
  * POST: /account/login
  */
 public function loginPost()
 {
     $model = new AccountLoginModel(Language::$LOG_IN[Config::$LANGUAGE], true);
     if ($model->validation) {
         $userDAO = new UserDAO();
         $userEntity = $userDAO->getUserWithRolesByEmail($model->email);
         $errorMessage = $userDAO->passwordVerify($userEntity->id, $model->password, $userEntity->passwordHash, $userEntity->lockoutEnabled, $userEntity->lockoutEndDate, $userEntity->accessFailedCount);
         if ($errorMessage == '') {
             Authentication::signIn($userEntity->uniqueId);
             (new BrowsingDAO())->addedBrowsingToUser($userEntity->id, Browsing::getBrowsingId());
             parent::redirectToUrlFromArray(explode('/', $model->url));
         }
         $model->emailValidation = Language::$INVALID_EMAIL_OR_PASSWORD[Config::$LANGUAGE] . ' ' . $errorMessage;
         $model->validation = false;
     }
     parent::view(new Login(), $model);
 }