Skip to content

Commit

Permalink
fixed logging when allow list applies to login
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoisChaumont committed Jul 2, 2024
1 parent 1fe6141 commit 7186004
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions plugins/Login/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,25 +152,26 @@ public function login($messageNoAccess = null, $infoMessage = false)
$ip = IP::getIpFromHeader();
try {
$list->checkIsAllowed($ip);
} catch (\Exception $e) {
}

Check failure on line 155 in plugins/Login/Controller.php

View workflow job for this annotation

GitHub Actions / PHPCS

Expected 1 space after closing brace; newline found
catch (\Exception $e) {
$messageNoAccess = Config::getInstance()->General['login_disabled_message'] ?? ' ';
}
} else {
if ($form->validate()) {
$nonce = $form->getSubmitValue('form_nonce');
$messageNoAccess = Nonce::verifyNonceWithErrorMessage('Login.login', $nonce, null);

// validate if there is error message
if ($messageNoAccess === "") {
$loginOrEmail = $form->getSubmitValue('form_login');
$login = $this->getLoginFromLoginOrEmail($loginOrEmail);

$password = $form->getSubmitValue('form_password');
try {
$this->authenticateAndRedirect($login, $password);
} catch (Exception $e) {
$messageNoAccess = $e->getMessage();
}
}

if (empty($messageNoAccess) && $form->validate()) {
$nonce = $form->getSubmitValue('form_nonce');
$messageNoAccess = Nonce::verifyNonceWithErrorMessage('Login.login', $nonce, null);

// validate if there is error message
if ($messageNoAccess === "") {
$loginOrEmail = $form->getSubmitValue('form_login');
$login = $this->getLoginFromLoginOrEmail($loginOrEmail);

$password = $form->getSubmitValue('form_password');
try {
$this->authenticateAndRedirect($login, $password);
} catch (Exception $e) {
$messageNoAccess = $e->getMessage();
}
}
}
Expand Down

0 comments on commit 7186004

Please sign in to comment.