コード例 #1
0
 public function login($username, $password)
 {
     parent::verifyIsUserOrExit();
     $username = parent::cleanInput($username);
     $password = parent::cleanInput($password);
     $pw = parent::getDBHandler()->getHashedPasswordFor($username);
     if (password_verify($password, $pw)) {
         $_SESSION[parent::ADMIN] = true;
         $_SESSION[parent::SESSION_USERNAME] = $username;
         $this->logger->info('AuthenticationController: Successfully logged in user ' . $username);
         return parent::createSuccessJSONObject();
     }
     $this->logger->info('AuthenticationController: Failed login attempt for ' . $username);
     return parent::createErrorJSONObject('Bad username / password combination');
 }