From 5ad7ea1b7b60de20e99c451564bf5f8e219ab8a8 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Thu, 24 Mar 2011 17:34:00 +0000 Subject: [PATCH] Fixed Trac #365: Give the user some feedback when the password was successfully changed/set. Note that iTop does not check that the new password is different from the old one. SVN:trunk[1147] --- application/itopwebpage.class.inc.php | 14 ++++++++++++++ application/loginwebpage.class.inc.php | 3 +++ dictionaries/dictionary.itop.ui.php | 1 + pages/UI.php | 3 ++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 32f42af83..c41242843 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -36,6 +36,7 @@ class iTopWebPage extends NiceWebPage private $m_aTabs; private $m_sCurrentTabContainer; private $m_sCurrentTab; + private $m_sMessage; public function __construct($sTitle) { @@ -44,6 +45,7 @@ class iTopWebPage extends NiceWebPage $this->m_sCurrentTab = ''; $this->m_aTabs = array(); $this->m_sMenu = ""; + $this->m_sMessage = ''; $oAppContext = new ApplicationContext(); $sExtraParams = $oAppContext->GetForLink(); // $this->m_currentOrganization = $currentOrganization; @@ -685,6 +687,10 @@ EOF } $sApplicationBanner .= ''; } + else if(strlen($this->m_sMessage)) + { + $sApplicationBanner = '
'.$this->m_sMessage.'
'; + } else { $sApplicationBanner = ''; @@ -898,6 +904,14 @@ EOF } } + /** + * Set the message to be displayed in the 'admin-banner' section at the top of the page + */ + public function SetMessage($sMessage) + { + $this->m_sMessage = $sMessage; + } + /* public function AddSearchForm($sClassName, $bOpen = false) { diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index 5e7ed9f25..a061996a5 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -352,6 +352,7 @@ EOF */ static function DoLogin($bMustBeAdmin = false, $bIsAllowedToPortalUsers = false) { + $sMessage = ''; // In case we need to return a message to the calling web page $operation = utils::ReadParam('loginop', ''); session_name(MetaModel::GetConfig()->Get('session_name')); session_start(); @@ -401,6 +402,7 @@ EOF $oPage->DisplayChangePwdForm(true); // old pwd was wrong $oPage->output(); } + $sMessage = Dict::S('UI:Login:PasswordChanged'); } self::Login(); @@ -419,6 +421,7 @@ EOF // No rights to be here, redirect to the portal header('Location: ../portal/index.php'); } + return $sMessage; } } // End of class diff --git a/dictionaries/dictionary.itop.ui.php b/dictionaries/dictionary.itop.ui.php index cb3ab7a24..1986f9654 100644 --- a/dictionaries/dictionary.itop.ui.php +++ b/dictionaries/dictionary.itop.ui.php @@ -456,6 +456,7 @@ Dict::Add('EN US', 'English', 'English', array( 'UI:LogOff:ThankYou' => 'Thank you for using iTop', 'UI:LogOff:ClickHereToLoginAgain' => 'Click here to login again...', 'UI:ChangePwdMenu' => 'Change Password...', + 'UI:Login:PasswordChanged' => 'Password successfully set !', 'UI:AccessRO-All' => 'iTop is read-only', 'UI:AccessRO-Users' => 'iTop is read-only for end-users', 'UI:Login:RetypePwdDoesNotMatch' => 'New password and retyped new password do not match !', diff --git a/pages/UI.php b/pages/UI.php index d611f07e3..923c2105b 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -562,12 +562,13 @@ try $oKPI = new ExecutionKPI(); require_once(APPROOT.'/application/loginwebpage.class.inc.php'); - LoginWebPage::DoLogin(); // Check user rights and prompt if needed + $sLoginMessage = LoginWebPage::DoLogin(); // Check user rights and prompt if needed $oAppContext = new ApplicationContext(); $oKPI->ComputeAndReport('User login'); $oP = new iTopWebPage(Dict::S('UI:WelcomeToITop')); + $oP->SetMessage($sLoginMessage); // All the following actions use advanced forms that require more javascript to be loaded switch($operation)