Skip to content

Commit

Permalink
N°5394 - use session for the FSM
Browse files Browse the repository at this point in the history
  • Loading branch information
eespie committed Sep 12, 2022
1 parent ca3c0cb commit 2a064fd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
4 changes: 2 additions & 2 deletions application/loginbasic.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ protected function OnCheckCredentials(&$iErrorCode)
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
Session::Set('auth_user', $sAuthUser);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand All @@ -70,8 +71,7 @@ protected function OnCredentialsOK(&$iErrorCode)
{
if (Session::Get('login_mode') == 'basic')
{
list($sAuthUser) = $this->GetAuthUserAndPassword();
LoginWebPage::OnLoginSuccess($sAuthUser, 'internal', Session::Get('login_mode'));
LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'internal', Session::Get('login_mode'));
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand Down
4 changes: 2 additions & 2 deletions application/loginexternal.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function OnCheckCredentials(&$iErrorCode)
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
Session::Set('auth_user', $sAuthUser);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand All @@ -53,8 +54,7 @@ protected function OnCredentialsOK(&$iErrorCode)
{
if (Session::Get('login_mode') == 'external')
{
$sAuthUser = $this->GetAuthUser();
LoginWebPage::OnLoginSuccess($sAuthUser, 'external', Session::Get('login_mode'));
LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'external', Session::Get('login_mode'));
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand Down
12 changes: 2 additions & 10 deletions application/loginform.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ protected function OnCheckCredentials(&$iErrorCode)
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
Session::Set('auth_user', $sAuthUser);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand All @@ -82,17 +83,8 @@ protected function OnCredentialsOK(&$iErrorCode)
{
if (Session::Get('login_mode') == 'form')
{
if (Session::IsSet('auth_user'))
{
// If FSM reenter this state (example 2FA) then the auth_user is not resubmitted
$sAuthUser = Session::Get('auth_user');
}
else
{
$sAuthUser = utils::ReadPostedParam('auth_user', '', 'raw_data');
}
// Store 'auth_user' in session for further use
LoginWebPage::OnLoginSuccess($sAuthUser, 'internal', Session::Get('login_mode'));
LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'internal', Session::Get('login_mode'));
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand Down
4 changes: 2 additions & 2 deletions application/loginurl.class.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ protected function OnCheckCredentials(&$iErrorCode)
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
return LoginWebPage::LOGIN_FSM_ERROR;
}
Session::Set('auth_user', $sAuthUser);
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand All @@ -68,8 +69,7 @@ protected function OnCredentialsOK(&$iErrorCode)
{
if (Session::Get('login_mode') == 'url')
{
$sAuthUser = utils::ReadParam('auth_user', '', false, 'raw_data');
LoginWebPage::OnLoginSuccess($sAuthUser, 'internal', Session::Get('login_mode'));
LoginWebPage::OnLoginSuccess(Session::Get('auth_user'), 'internal', Session::Get('login_mode'));
}
return LoginWebPage::LOGIN_FSM_CONTINUE;
}
Expand Down

0 comments on commit 2a064fd

Please sign in to comment.