prevent password managers from messing up edit_web form

This commit is contained in:
Alexey Verkhovsky 2005-01-23 18:23:27 +00:00
parent 805d4a829e
commit a3142c377a

View file

@ -7,10 +7,10 @@
Ex: the address "rails" gives URLs like <i>/rails/show/HomePage</i>. Ex: the address "rails" gives URLs like <i>/rails/show/HomePage</i>.
</div> </div>
<div class="inputBox"> <div class="inputBox, disableAutoComplete">
Name: <input type="text" id="name" name="name" value="<%= @web.name %>" onChange="proposeAddress();" /> &nbsp;&nbsp; Name: <input type="text" id="name" name="name" value="<%= @web.name %>" onChange="proposeAddress();" /> &nbsp;&nbsp;
Address: <input type="text" id="address" name="address" value="<%= @web.address %>" onChange="cleanAddress();" /> Address: <input type="text" id="address" name="address" value="<%= @web.address %>" onChange="cleanAddress();" />
<i>(Letters & digits only)</i> <i>(Letters and digits only)</i>
</div> </div>
<h2 style="margin-bottom: 3px">Specialize</h2> <h2 style="margin-bottom: 3px">Specialize</h2>
@ -20,7 +20,7 @@
Additions to the stylesheet take precedence over the existing styles. <i>Hint:</i> View source on a page you want to Additions to the stylesheet take precedence over the existing styles. <i>Hint:</i> View source on a page you want to
style to find ID names on individual tags. <a href="#" onClick="document.getElementById('additionalStyle').style.display='block';return false;">See styles >></a> style to find ID names on individual tags. <a href="#" onClick="document.getElementById('additionalStyle').style.display='block';return false;">See styles >></a>
</div> </div>
<div class="inputBox"> <div class="inputBox, disableAutoComplete">
Markup: Markup:
<select name="markup"> <select name="markup">
<%= html_options({ "Textile" => :textile, "Markdown" => :markdown, "RDoc" => :rdoc }, @web.markup) %> <%= html_options({ "Textile" => :textile, "Markdown" => :markdown, "RDoc" => :rdoc }, @web.markup) %>
@ -51,8 +51,8 @@
This is the password that visitors need to view and edit this web. Setting the password to nothing will remove the password protection. This is the password that visitors need to view and edit this web. Setting the password to nothing will remove the password protection.
</div> </div>
<div class="inputBox"> <div class="inputBox">
Password: <input type="password" id="password" name="password" value="<%= @web.password %>"> &nbsp;&nbsp; Password: <input class="disableAutoComplete" type="password" id="password" name="password" value="<%= @web.password %>"> &nbsp;&nbsp;
Verify: <input type="password" id="password_check" value="<%= @web.password %>" name="password_check"> Verify: <input class="disableAutoComplete" type="password" id="password_check" value="<%= @web.password %>" name="password_check">
</div> </div>
<h2 style="margin-bottom: 3px">Publish read-only version of this web (<%= @web.name %>)</h2> <h2 style="margin-bottom: 3px">Publish read-only version of this web (<%= @web.name %>)</h2>
@ -67,7 +67,7 @@
<p align="right"> <p align="right">
<small> <small>
Enter system password Enter system password
<input type="password" id="system_password" name="system_password"> <input type="password" class="disableAutoComplete" id="system_password" name="system_password">
and and
<input type="submit" value="Update Web"> <input type="submit" value="Update Web">
<br/><br/> <br/><br/>
@ -126,4 +126,17 @@ function validateSetup() {
return true; return true;
} }
// overriding auto-complete by form managers
// code by Chris Holland, lifted from
// http://chrisholland.blogspot.com/2004/11/banks-protect-privacy-disable.html
if (document.getElementsByTagName) {
var inputElements = document.getElementsByTagName("input");
for (i=0; inputElements[i]; i++) {
if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutoComplete") != -1)) {
inputElements[i].setAttribute("autocomplete","off");
}//if current input element has the disableAutoComplete class set.
}//loop thru input elements
}
</script> </script>