Module: nagvis Branch: master Commit: e1db5271c5446d134b5d28f010c52a45c4c93475 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=e1db5271c5446d134b5d28f010c52a45c4c93475
Author: LaMi <[email protected]> Date: Wed Nov 4 23:27:36 2009 +0100 Fixed messages and redirection when logging on --- share/frontend/nagvis-js/js/frontend.js | 17 ++++++++++++++++- share/server/core/classes/CoreModAuth.php | 11 ++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/share/frontend/nagvis-js/js/frontend.js b/share/frontend/nagvis-js/js/frontend.js index 5bf9338..65daa71 100644 --- a/share/frontend/nagvis-js/js/frontend.js +++ b/share/frontend/nagvis-js/js/frontend.js @@ -50,8 +50,23 @@ function submitFrontendForm(sUrl, sFormId) { frontendMessage(oMsg); oMsg = null; + // Maybe there is a request for a reload/redirect + if(typeof oResult.redirectTime !== 'undefined') { + var sUrl = window.location.href; + + // Maybe enable redirect + if(typeof oResult.redirectUrl !== 'undefined') { + sUrl = oResult.redirectUrl; + } + + // Register reload/redirect + setTimeout(function() {window.location = sUrl;}, oResult.redirectTime*1000); + } + // Additionally close the popup window when the response is positive - popupWindowClose(); + if(typeof popupWindowClose == 'function') { + popupWindowClose(); + } } } diff --git a/share/server/core/classes/CoreModAuth.php b/share/server/core/classes/CoreModAuth.php index 9a34e16..20f8f94 100644 --- a/share/server/core/classes/CoreModAuth.php +++ b/share/server/core/classes/CoreModAuth.php @@ -33,7 +33,10 @@ class CoreModAuth extends CoreModule { // Try to authenticate the user if($this->AUTHENTICATION->isAuthenticated()) { // Display success with link and refresh in 5 seconds to called page - $sReturn = $this->msgAuthenticated(); + $sReturn = json_encode(Array('status' => 'OK', + 'message' => $this->CORE->getLang()->getText('You have been authenticated. You will be redirected.'), + 'redirectTime' => 1, + 'redirectUrl' => $this->CORE->getMainCfg()->getValue('paths', 'htmlbase'))); } else { // Invalid credentials // FIXME: Count tries and maybe block somehow @@ -101,12 +104,6 @@ class CoreModAuth extends CoreModule { return ''; } - public function msgAuthenticated() { - new GlobalMessage('NOTE', $this->CORE->getLang()->getText('You have been authenticated. You will be redirected.'), null, null, 1, $this->FHANDLER->getReferer()); - - return ''; - } - public function msgInvalidCredentials() { new GlobalMessage('ERROR', $this->CORE->getLang()->getText('You entered invalid credentials.'), null, $this->CORE->getLang()->getText('Authentication failed'), 1, $this->FHANDLER->getReferer()); ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
