瀏覽代碼

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 年之前
父節點
當前提交
a28f3996cf
共有 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='70%' class='vtable'>";
 	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 {
 		echo "		".$username;
@@ -472,7 +472,7 @@ if (count($_POST) > 0 && $_POST["persistform"] != "1") {
 
 	echo "	<tr>";
 	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 "		<td class='vncell' valign='top'>".$text['label-confirm_password']."</td>";