Improved flow for using OAuth2 while logged out.

This commit is contained in:
flash 2025-02-02 19:50:54 +00:00
parent 8be630531a
commit 8f63b57c0c
9 changed files with 35 additions and 93 deletions
public-legacy/auth

View file

@ -120,7 +120,7 @@ while(!empty($_POST['login']) && is_array($_POST['login'])) {
if($userInfo->hasTOTP) {
$tfaToken = $msz->authCtx->tfaSessions->createToken($userInfo);
Tools::redirect($msz->urls->format('auth-two-factor', ['token' => $tfaToken]));
Tools::redirect($msz->urls->format('auth-two-factor', ['token' => $tfaToken, 'redirect' => $loginRedirect]));
return;
}
@ -149,6 +149,7 @@ while(!empty($_POST['login']) && is_array($_POST['login'])) {
}
$welcomeMode = !empty($_GET['welcome']);
$oauth2Mode = !empty($_GET['oauth2']);
$loginUsername = !empty($_POST['login']['username']) && is_string($_POST['login']['username']) ? $_POST['login']['username'] : (
!empty($_GET['username']) && is_string($_GET['username']) ? $_GET['username'] : ''
);
@ -163,6 +164,7 @@ Template::render('auth.login', [
'login_can_register' => $canRegisterAccount,
'login_attempts_remaining' => $remainingAttempts,
'login_welcome' => $welcomeMode,
'login_oauth2' => $oauth2Mode,
'login_private' => [
'enabled' => $siteIsPrivate,
'message' => $sitePrivateMessage,