فهرست منبع

- Check consistency of the retyped password when changing password

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@533 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 15 سال پیش
والد
کامیت
f5903b2a46
3فایلهای تغییر یافته به همراه28 افزوده شده و 3 حذف شده
  1. 24 1
      application/loginwebpage.class.inc.php
  2. 2 1
      dictionaries/dictionary.itop.ui.php
  3. 2 1
      dictionaries/fr.dictionary.itop.ui.php

+ 24 - 1
application/loginwebpage.class.inc.php

@@ -118,6 +118,24 @@ EOF
 		$sAuthPwd = utils::ReadParam('suggest_pwd', '');
 
 		$sVersionShort = Dict::Format('UI:iTopVersion:Short', ITOP_VERSION);
+		$sInconsistenPwdMsg = Dict::S('UI:Login:RetypePwdDoesNotMatch');
+		$this->add_script(<<<EOF
+function GoBack()
+{
+	window.history.back();
+}
+
+function DoCheckPwd()
+{
+	if ($('#new_pwd').val() != $('#retype_new_pwd').val())
+	{
+		alert('$sInconsistenPwdMsg');
+		return false;
+	}
+	return true;
+}
+EOF
+);
 		$this->add("<div id=\"login-logo\"><a href=\"http://www.combodo.com/itop\"><img title=\"$sVersionShort\" src=\"../images/itop-logo.png\"></a></div>\n");
 		$this->add("<div id=\"login\">\n");
 		$this->add("<h1>".Dict::S('UI:Login:ChangeYourPassword')."</h1>\n");
@@ -130,7 +148,7 @@ EOF
 		$this->add("<tr><td><label for=\"old_pwd\">".Dict::S('UI:Login:OldPasswordPrompt').":</label></td><td><input type=\"password\" id=\"old_pwd\" name=\"old_pwd\" value=\"\" /></td></tr>\n");
 		$this->add("<tr><td><label for=\"new_pwd\">".Dict::S('UI:Login:NewPasswordPrompt').":</label></td><td><input type=\"password\" id=\"new_pwd\" name=\"new_pwd\" value=\"\" /></td></tr>\n");
 		$this->add("<tr><td><label for=\"retype_new_pwd\">".Dict::S('UI:Login:RetypeNewPasswordPrompt').":</label></td><td><input type=\"password\" id=\"retype_new_pwd\" name=\"retype_new_pwd\" value=\"\" /></td></tr>\n");
-		$this->add("<tr><td colspan=\"2\" class=\"center v-spacer\">  <input type=\"button\" onClick=\"GoBack();\" value=\"".Dict::S('UI:Button:Cancel')."\" />&nbsp;&nbsp;<input type=\"submit\" value=\"".Dict::S('UI:Button:ChangePassword')."\" /></td></tr>\n");
+		$this->add("<tr><td colspan=\"2\" class=\"center v-spacer\">  <input type=\"button\" onClick=\"GoBack();\" value=\"".Dict::S('UI:Button:Cancel')."\" />&nbsp;&nbsp;<input type=\"submit\" onClick=\"return DoCheckPwd();\" value=\"".Dict::S('UI:Button:ChangePassword')."\" /></td></tr>\n");
 		$this->add("</table>\n");
 		$this->add("<input type=\"hidden\" name=\"loginop\" value=\"do_change_pwd\" />\n");
 		$this->add("</form>\n");
@@ -220,6 +238,9 @@ EOF
 		
 		if ($operation == 'change_pwd')
 		{
+			$sAuthUser = $_SESSION['auth_user'];
+			$sAuthPwd = $_SESSION['auth_pwd'];
+			UserRights::Login($sAuthUser, $sAuthPwd); // Set the user's language
 			$oPage = new LoginWebPage();
 			$oPage->DisplayChangePwdForm();
 			$oPage->output();
@@ -228,6 +249,8 @@ EOF
 		if ($operation == 'do_change_pwd')
 		{
 			$sAuthUser = $_SESSION['auth_user'];
+			$sAuthPwd = $_SESSION['auth_pwd'];
+			UserRights::Login($sAuthUser, $sAuthPwd); // Set the user's language
 			$sOldPwd = utils::ReadPostedParam('old_pwd');
 			$sNewPwd = utils::ReadPostedParam('new_pwd');
 			if (UserRights::CanChangePassword() && ((!UserRights::Login($sAuthUser, $sOldPwd)) || (!UserRights::ChangePassword($sOldPwd, $sNewPwd))))

+ 2 - 1
dictionaries/dictionary.itop.ui.php

@@ -443,8 +443,9 @@ Dict::Add('EN US', 'English', 'English', array(
 	'UI:Login:NewPasswordPrompt' => 'New password',
 	'UI:Login:RetypeNewPasswordPrompt' => 'Retype new password',
 	'UI:Login:IncorrectOldPassword' => 'Error: the old password is incorrect',
-	'UI:LogoffMenu' => 'Log off',
+	'UI:LogOffMenu' => 'Log off',
 	'UI:ChangePwdMenu' => 'Change Password...',
+	'UI:Login:RetypePwdDoesNotMatch' => 'New password and retyped new password do not match !',
 	'UI:Button:Login' => 'Enter iTop',
 	'UI:Login:Error:AccessRestricted' => 'iTop access is restricted. Please, contact an iTop administrator.',
 	'UI:CSVImport:MappingSelectOne' => '-- select one --',

+ 2 - 1
dictionaries/fr.dictionary.itop.ui.php

@@ -435,8 +435,9 @@ Dict::Add('FR FR', 'French', 'Français', array(
 	'UI:Login:NewPasswordPrompt' => 'Nouveau mot de passe',
 	'UI:Login:RetypeNewPasswordPrompt' => 'Resaisir le nouveau mot de passe',
 	'UI:Login:IncorrectOldPassword' => 'Erreur: l\'ancien mot de passe est incorrect',
-	'UI:LogoffMenu' => 'Déconnexion',
+	'UI:LogOffMenu' => 'Déconnexion',
 	'UI:ChangePwdMenu' => 'Changer de mot de passe...',
+	'UI:Login:RetypePwdDoesNotMatch' => 'Les deux saisies du nouveau mot de passe ne sont pas identiques !',
 	'UI:Button:Login' => 'Entrer dans iTop',
 	'UI:Login:Error:AccessRestricted' => 'L\'accès à iTop est soumis à autorisation. Merci de contacter votre administrateur iTop.',
 	'UI:CSVImport:MappingSelectOne' => '-- choisir une valeur --',