diff --git a/webui/controller/login/login.php b/webui/controller/login/login.php index 8ef8ebd0..c9aafc2f 100644 --- a/webui/controller/login/login.php +++ b/webui/controller/login/login.php @@ -55,24 +55,27 @@ class ControllerLoginLogin extends Controller { else { $data = $session->get("auth_data"); - $this->model_user_auth->apply_user_auth_session($data); - $session->remove("auth_data"); - $this->model_user_prefs->get_user_preferences($session->get('username')); + if(isset($data['username'])) { + $this->model_user_auth->apply_user_auth_session($data); + $session->remove("auth_data"); - if(ENABLE_SAAS == 1) { - $this->model_saas_customer->online($session->get('email')); - } + $this->model_user_prefs->get_user_preferences($session->get('username')); - LOGGER('logged in'); + if(ENABLE_SAAS == 1) { + $this->model_saas_customer->online($session->get('email')); + } - if(isAdminUser() == 1) { - header("Location: " . SITE_URL . "index.php?route=health/health"); + LOGGER('logged in'); + + if(isAdminUser() == 1) { + header("Location: " . SITE_URL . "index.php?route=health/health"); + exit; + } + + header("Location: " . SITE_URL . "search.php"); exit; } - - header("Location: " . SITE_URL . "search.php"); - exit; } } else { diff --git a/webui/model/user/auth.php b/webui/model/user/auth.php index 66fa0692..f41f334f 100644 --- a/webui/model/user/auth.php +++ b/webui/model/user/auth.php @@ -41,7 +41,13 @@ class ModelUserAuth extends Model { if(ENABLE_LDAP_AUTH == 1) { $ok = $this->checkLoginAgainstLDAP($username, $password, $data); - if($ok == 1) { return $ok; } + if($ok == 1) { + if(CUSTOM_EMAIL_QUERY_FUNCTION && function_exists(CUSTOM_EMAIL_QUERY_FUNCTION)) { + call_user_func(CUSTOM_EMAIL_QUERY_FUNCTION, $username); + } + + return $ok; + } } if(ENABLE_IMAP_AUTH == 1) {