Преглед на файлове

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.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1147 a333f486-631f-4898-b8df-5754b55c2be0
dflaven преди 14 години
родител
ревизия
bade681081
променени са 4 файла, в които са добавени 20 реда и са изтрити 1 реда
  1. 14 0
      application/itopwebpage.class.inc.php
  2. 3 0
      application/loginwebpage.class.inc.php
  3. 1 0
      dictionaries/dictionary.itop.ui.php
  4. 2 1
      pages/UI.php

+ 14 - 0
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 .= '</div>';
 		}
+		else if(strlen($this->m_sMessage))
+		{
+			$sApplicationBanner = '<div id="admin-banner"><span style="padding:5px;">'.$this->m_sMessage.'<span></div>';
+		}
 		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)
     {

+ 3 - 0
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

+ 1 - 0
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 !',

+ 2 - 1
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)