[Web] fix bug on mailbox login
This commit is contained in:
parent
e5cac098ef
commit
2a02bae53e
|
@ -333,26 +333,16 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $is_internal = fa
|
||||||
return 'user';
|
return 'user';
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to create mbox on successfull login
|
// check if matching attribute exist
|
||||||
$mbox_template = null;
|
$mapper_key = array_search($user_template, $iam_settings['mappers']);
|
||||||
// check if matching attribute mapping exists
|
if ($mapper_key === false) return false;
|
||||||
foreach ($iam_settings['mappers'] as $index => $mapper){
|
|
||||||
if (in_array($mapper, $iam_settings['mappers'])) {
|
|
||||||
$mbox_template = $iam_settings['templates'][$index];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$mbox_template){
|
|
||||||
// no matching template found
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create mailbox
|
// create mailbox
|
||||||
$create_res = mailbox('add', 'mailbox_from_template', array(
|
$create_res = mailbox('add', 'mailbox_from_template', array(
|
||||||
'domain' => explode('@', $user)[1],
|
'domain' => explode('@', $user)[1],
|
||||||
'local_part' => explode('@', $user)[0],
|
'local_part' => explode('@', $user)[0],
|
||||||
'authsource' => 'keycloak',
|
'authsource' => 'keycloak',
|
||||||
'template' => $mbox_template
|
'template' => $iam_settings['mappers'][$mapper_key]
|
||||||
));
|
));
|
||||||
if (!$create_res) return false;
|
if (!$create_res) return false;
|
||||||
|
|
||||||
|
|
|
@ -2162,7 +2162,8 @@ function identity_provider($_action, $_data = null, $_extra = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if matching attribute exist
|
// check if matching attribute exist
|
||||||
if (array_search($user_template, $provider['mappers']) === false) {
|
$mapper_key = array_search($user_template, $provider['mappers']);
|
||||||
|
if ($mapper_key === false) {
|
||||||
clear_session();
|
clear_session();
|
||||||
$_SESSION['return'][] = array(
|
$_SESSION['return'][] = array(
|
||||||
'type' => 'danger',
|
'type' => 'danger',
|
||||||
|
@ -2177,7 +2178,7 @@ function identity_provider($_action, $_data = null, $_extra = null) {
|
||||||
'domain' => explode('@', $info['email'])[1],
|
'domain' => explode('@', $info['email'])[1],
|
||||||
'local_part' => explode('@', $info['email'])[0],
|
'local_part' => explode('@', $info['email'])[0],
|
||||||
'authsource' => identity_provider('get')['authsource'],
|
'authsource' => identity_provider('get')['authsource'],
|
||||||
'template' => $user_template
|
'template' => $provider['templates'][$mapper_key]
|
||||||
));
|
));
|
||||||
if (!$create_res){
|
if (!$create_res){
|
||||||
clear_session();
|
clear_session();
|
||||||
|
|
Loading…
Reference in New Issue