Update ACL\Login with internal ajax_page flag override
Also ajax flag return method
This commit is contained in:
@@ -1318,11 +1318,14 @@ EOM;
|
||||
/**
|
||||
* Main call that needs to be run to actaully check for login
|
||||
* If this is not called, no login checks are done, unless the class
|
||||
* is initialzied with the legacy call parameter
|
||||
* is initialzied with the legacy call parameter.
|
||||
* If ajax_page is true or AJAX_PAGE global var is true then the internal
|
||||
* ajax flag will be set and no echo or exit will be done.
|
||||
*
|
||||
* @param bool $ajax_page [false] Set to true to never print out anythng
|
||||
* @return void
|
||||
*/
|
||||
public function loginMainCall(): void
|
||||
public function loginMainCall(bool $ajax_page = false): void
|
||||
{
|
||||
// start with no error
|
||||
$this->login_error = 0;
|
||||
@@ -1388,7 +1391,10 @@ EOM;
|
||||
// set global is ajax page for if we show the data directly,
|
||||
// or need to pass it back
|
||||
// to the continue AJAX class for output back to the user
|
||||
$this->login_is_ajax_page = isset($GLOBALS['AJAX_PAGE']) && $GLOBALS['AJAX_PAGE'] ? true : false;
|
||||
$this->login_is_ajax_page = false;
|
||||
if ($ajax_page === true || !empty($GLOBALS['AJAX_PAGE'])) {
|
||||
$this->login_is_ajax_page = true;
|
||||
}
|
||||
|
||||
// if there is none, there is none, saves me POST/GET check
|
||||
$this->euid = array_key_exists('EUID', $_SESSION) ? $_SESSION['EUID'] : 0;
|
||||
@@ -1493,6 +1499,12 @@ EOM;
|
||||
$_GET = [];
|
||||
// set the action to login so we can trigger special login html return
|
||||
$_POST['action'] = 'login';
|
||||
$_POST['login_exit'] = 3000;
|
||||
$_POST['login_error'] = $this->loginGetLastErrorCode();
|
||||
$_POST['login_error_text'] = $this->loginGetErrorMsg(
|
||||
$this->loginGetLastErrorCode(),
|
||||
true
|
||||
);
|
||||
$_POST['login_html'] = $this->login_html;
|
||||
// NOTE: this part needs to be catched by the frontend AJAX
|
||||
// and some function needs to then set something like this
|
||||
@@ -1523,6 +1535,16 @@ EOM;
|
||||
return $this->page_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current flag if this call is for an ajax type apge
|
||||
*
|
||||
* @return bool True for yes, False for normal HTML return
|
||||
*/
|
||||
public function loginGetAjaxFlag(): bool
|
||||
{
|
||||
return $this->login_is_ajax_page;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the last set error code
|
||||
*
|
||||
|
||||
@@ -26,7 +26,7 @@ class DotEnv
|
||||
* @param string $env_file What file to load, default is .env
|
||||
* @return int -1 other error
|
||||
* 0 for success full load
|
||||
* 1 for file loadable, but no data inside
|
||||
* 1 for file loadable, no data or data already loaded
|
||||
* 2 for file not readable or open failed
|
||||
* 3 for file not found
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user