Преглед изворни кода

Browser developers disabled autocomplete in most browser. A move that makes an assumption that autocomplete is always good. In this particular case it creates a bug. There are a few legitimate reasons to disable autocomplete. In this case I'm disabling it as we are only updating the password when its provided by the user. In this case the user may be and administrator changing a user a password in this case autocomplete would offer the wrong password. Another case have two password fields that must match if both passwords are empty then the passwords are not updated allowing for other user settings to be updated.

markjcrane пре 10 година
родитељ
комит
aa963226f2
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      core/users/usersupdate.php

+ 2 - 2
core/users/usersupdate.php

@@ -462,7 +462,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
 	echo "		<td width='30%' class='vncellreq' valign='top'>".$text['label-username']."</td>";
 	echo "		<td width='30%' class='vncellreq' valign='top'>".$text['label-username']."</td>";
 	echo "		<td width='70%' class='vtable'>";
 	echo "		<td width='70%' class='vtable'>";
 	if (if_group("admin") || if_group("superadmin")) {
 	if (if_group("admin") || if_group("superadmin")) {
-		echo "		<input type='txt' autocomplete='off' class='formfld' name='username' value='".$username."' required='required'>";
+		echo "		<input type='txt' class='formfld' name='username' value='".$username."' required='required'>";
 	}
 	}
 	else {
 	else {
 		echo "		".$username;
 		echo "		".$username;
@@ -472,7 +472,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
 
 
 	echo "	<tr>";
 	echo "	<tr>";
 	echo "		<td class='vncell' valign='top'>".$text['label-password']."</td>";
 	echo "		<td class='vncell' valign='top'>".$text['label-password']."</td>";
-	echo "		<td class='vtable'><input type='password' autocomplete='off' class='formfld' name='password' id='password' value='' onfocus='compare_passwords();' onkeyup='compare_passwords();' onblur='compare_passwords();'></td>";
+	echo "		<td class='vtable'><input style='display:none;' type='password' name='autocomplete'><input type='password' autocomplete='off' class='formfld' name='password' id='password' value='' onfocus='compare_passwords();' onkeyup='compare_passwords();' onblur='compare_passwords();'></td>";
 	echo "	</tr>";
 	echo "	</tr>";
 	echo "	<tr>";
 	echo "	<tr>";
 	echo "		<td class='vncell' valign='top'>".$text['label-confirm_password']."</td>";
 	echo "		<td class='vncell' valign='top'>".$text['label-confirm_password']."</td>";