Skip to content

Commit

Permalink
Fixed error when accessing the login page without POST data (GET)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni authored and ipula committed Jan 11, 2024
1 parent bcdf5d6 commit e64b6f3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pages/login/LoginHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ public function signIn($args, $request)
}
}

$username = $request->getUserVar('username');
$reason = null;
$user = $error ? false : Validation::login($request->getUserVar('username'), $request->getUserVar('password'), $reason, !!$request->getUserVar('remember'));
$user = $error || !strlen($username ?? '')
? null
: Validation::login($username, $request->getUserVar('password'), $reason, !!$request->getUserVar('remember'));
if ($user) {
if ($user->getMustChangePassword()) {
// User must change their password in order to log in
Expand All @@ -170,7 +173,7 @@ public function signIn($args, $request)


$templateMgr->assign([
'username' => $request->getUserVar('username'),
'username' => $username,
'remember' => $request->getUserVar('remember'),
'source' => $request->getUserVar('source'),
'showRemember' => Config::getVar('general', 'session_lifetime') > 0,
Expand Down Expand Up @@ -224,7 +227,7 @@ public function requestResetPassword($args, $request)
$user = Repo::user()->getByEmail($email, true); /** @var User $user */

if ($user !== null) {

if ($user->getDisabled()) {
$templateMgr
->assign([
Expand All @@ -234,7 +237,7 @@ public function requestResetPassword($args, $request)
: __('user.login.accountDisabledWithReason', ['reason' => htmlspecialchars($reason)])
])
->display('frontend/pages/userLostPassword.tpl');

return;
}

Expand Down

0 comments on commit e64b6f3

Please sign in to comment.