Module: nagvis Branch: master Commit: 699a3168fb65fde478b2b95623b4cad061f463f2 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=699a3168fb65fde478b2b95623b4cad061f463f2
Author: Lars Michelsen <[email protected]> Date: Sat Apr 24 17:13:59 2010 +0200 #262 Redirect to requested page after login --- .../nagvis-js/classes/FrontendModLogonDialog.php | 7 ++++++- .../nagvis-js/classes/FrontendModLogonEnv.php | 14 +++++++++----- share/server/core/classes/CoreModAuth.php | 9 ++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/share/frontend/nagvis-js/classes/FrontendModLogonDialog.php b/share/frontend/nagvis-js/classes/FrontendModLogonDialog.php index b719903..9783d86 100644 --- a/share/frontend/nagvis-js/classes/FrontendModLogonDialog.php +++ b/share/frontend/nagvis-js/classes/FrontendModLogonDialog.php @@ -46,7 +46,12 @@ class FrontendModLogonDialog extends FrontendModule { $sReturn = $VIEW->parse(); } else { // When the user is already authenticated redirect to start page (overview) - Header('Location:'.$this->CORE->getMainCfg()->getValue('paths', 'htmlbase')); + $FHANDLER = new CoreRequestHandler($_POST); + $ref = $FHANDLER->getRequestUri(); + if($ref === '') { + $ref = $this->CORE->getMainCfg()->getValue('paths', 'htmlbase'); + } + Header('Location:'.$ref); } break; } diff --git a/share/frontend/nagvis-js/classes/FrontendModLogonEnv.php b/share/frontend/nagvis-js/classes/FrontendModLogonEnv.php index d95fcf8..75177ea 100644 --- a/share/frontend/nagvis-js/classes/FrontendModLogonEnv.php +++ b/share/frontend/nagvis-js/classes/FrontendModLogonEnv.php @@ -97,11 +97,8 @@ class FrontendModLogonEnv extends FrontendModule { // Try to authenticate the user if($this->AUTHENTICATION->isAuthenticated(AUTH_TRUST_USERNAME)) { - // Display success with link and refresh in 5 seconds to called page - $FHANDLER = new CoreRequestHandler($_POST); - // Redirect without message to the user - //new GlobalMessage('NOTE', $this->CORE->getLang()->getText('You have been authenticated. You will be redirected.'), null, null, 1, $FHANDLER->getReferer()); + $FHANDLER = new CoreRequestHandler($_POST); $ref = $FHANDLER->getRequestUri(); if($ref === '') { $ref = $this->CORE->getMainCfg()->getValue('paths', 'htmlbase'); @@ -127,8 +124,15 @@ class FrontendModLogonEnv extends FrontendModule { return false; } } else { + // Redirect without message to the user + $FHANDLER = new CoreRequestHandler($_POST); + $ref = $FHANDLER->getRequestUri(); + if($ref === '') { + $ref = $this->CORE->getMainCfg()->getValue('paths', 'htmlbase'); + } + // When the user is already authenticated redirect to start page (overview) - header('Location:'.$this->CORE->getMainCfg()->getValue('paths', 'htmlbase')); + header('Location:'.$ref); } break; } diff --git a/share/server/core/classes/CoreModAuth.php b/share/server/core/classes/CoreModAuth.php index ea28945..3a48aa2 100644 --- a/share/server/core/classes/CoreModAuth.php +++ b/share/server/core/classes/CoreModAuth.php @@ -32,8 +32,15 @@ class CoreModAuth extends CoreModule { // Try to authenticate the user if($this->AUTHENTICATION->isAuthenticated()) { + // When the user is already authenticated redirect to start page (overview) + $HANDLER = new CoreRequestHandler($_POST); + $ref = $HANDLER->getReferer(); + if($ref === '') { + $ref = $this->CORE->getMainCfg()->getValue('paths', 'htmlbase'); + } + // Display success with link and refresh in 5 seconds to called page - new GlobalMessage('NOTE', $this->CORE->getLang()->getText('You have been authenticated. You will be redirected.'), null, null, 1, $this->CORE->getMainCfg()->getValue('paths', 'htmlbase')); + new GlobalMessage('NOTE', $this->CORE->getLang()->getText('You have been authenticated. You will be redirected.'), null, null, 1, $ref); } else { // Invalid credentials // FIXME: Count tries and maybe block somehow ------------------------------------------------------------------------------ _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
