Skip to content
Snippets Groups Projects
Commit 06caf382 authored by Olimpia Magliulo's avatar Olimpia Magliulo
Browse files

Bug fix: change language after login error

As for loginuserpass, fixes a bug that didn't allow to change language after a login error was shown.
parent 0785551e
No related branches found
No related tags found
No related merge requests found
......@@ -49,6 +49,14 @@ if (array_key_exists('organization', $_REQUEST)) {
$errorCode = NULL;
$errorParams = NULL;
$queryParams = array();
if (isset($state['error'])) {
$errorCode = $state['error']['code'];
$errorParams = $state['error']['params'];
$queryParams = array('AuthState' => $authStateId);
}
if ($organizations === NULL || !empty($organization)) {
if (!empty($username) || !empty($password)) {
......@@ -66,7 +74,16 @@ if ($organizations === NULL || !empty($organization)) {
// Login failed. Extract error code and parameters, to display the error
$errorCode = $e->getErrorCode();
$errorParams = $e->getParameters();
$state['error']= array(
'code' => $errorCode,
'params' => $errorParams
);
$authStateId = SimpleSAML_Auth_State::saveState($state, sspmod_core_Auth_UserPassOrgBase::STAGEID);
$queryParams = array('AuthState' => $authStateId);
}
if (isset($state['error'])){
unset($state['error']);
}
}
}
......@@ -84,6 +101,10 @@ $t->data['errorcode'] = $errorCode;
$t->data['errorcodes'] = SimpleSAML\Error\ErrorCodes::getAllErrorCodeMessages();
$t->data['errorparams'] = $errorParams;
if (!empty($queryParams)) {
$t->data['queryParams'] = $queryParams;
}
if ($organizations !== NULL) {
$t->data['selectedOrg'] = $organization;
$t->data['organizations'] = $organizations;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment