Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,27 @@ protected static function _log($status, $imap_ob)
*/
public static function getAutoLoginServer()
{
global $session;

if (($servers = IMP_Imap::loadServerConfig()) === false) {
return null;
}

// Honor a server explicitly selected on the Horde login screen, even
// when Horde itself authenticated through a driver unrelated to IMP
// (LDAP, SQL, ...). horde/base's login.php stores raw posted values
// per app in the session; only IMP interprets the 'imp_server_key'
// field.
$login_params = $session->exists('horde', 'login_app_params')
? $session->get('horde', 'login_app_params')
: [];
$selected = $login_params['imp']['imp_server_key'] ?? null;
if (!empty($selected) && isset($servers[$selected])) {
return $selected;
}

$server_key = null;

foreach ($servers as $key => $val) {
if (is_null($server_key) && (substr($key, 0, 1) != '_')) {
$server_key = $key;
Expand Down
Loading