function mci_check_login($p_username, $p_password) { if (mci_is_mantis_offline()) { return false; } # if no user name supplied, then attempt to login as anonymous user. if (is_blank($p_username)) { $t_anon_allowed = config_get('allow_anonymous_login'); if (OFF == $t_anon_allowed) { return false; } $p_username = config_get('anonymous_account'); # do not use password validation. $p_password = null; } else { if (is_blank($p_password)) { # require password for authenticated access return false; } } if (false === auth_attempt_script_login($p_username, $p_password)) { return false; } return auth_get_current_user_id(); }
/** * handle a soap API login * @param string $p_username Login username. * @param string $p_password Login password. * @return integer|false return user_id if successful, otherwise false. */ function mci_check_login($p_username, $p_password) { if (mci_is_mantis_offline()) { return false; } # Must not pass in password, otherwise, authentication will be by-passed. $t_password = $p_password === null ? '' : $p_password; if (false === auth_attempt_script_login($p_username, $t_password)) { return false; } return auth_get_current_user_id(); }
/** * handle a soap API login * @param string $p_username Login username. * @param string $p_password Login password. * @return integer|false return user_id if successful, otherwise false. */ function mci_check_login($p_username, $p_password) { if (mci_is_mantis_offline()) { return false; } # Must not pass in null password, otherwise, authentication will be by-passed # by auth_attempt_script_login(). $t_password = $p_password === null ? '' : $p_password; # Validate the token if (api_token_validate($p_username, $t_password)) { # Token is valid, then login the user without worrying about a password. if (auth_attempt_script_login($p_username, null) === false) { return false; } } else { # Not a valid token, validate as username + password. if (auth_attempt_script_login($p_username, $t_password) === false) { return false; } } return auth_get_current_user_id(); }