Make show-password-js work for change password too
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 5 Jan 2012 13:47:15 +0000 (14:47 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 5 Jan 2012 13:47:15 +0000 (14:47 +0100)
The show password js depends on the password field to have
an id of "password". So give it a proper id.

Also fixed the label generation for the case of field.name
and field.id being different.

mediagoblin/edit/forms.py
mediagoblin/templates/mediagoblin/utils/wtforms.html

index df2190110aa4d2608dc73e8aecd950a37377b08a..099558742bd5189cbf32380cda9b6942d39f942f 100644 (file)
@@ -64,7 +64,8 @@ class EditAccountForm(wtforms.Form):
     new_password = wtforms.PasswordField(
         _('New password'),
         [wtforms.validators.Required(),
-         wtforms.validators.Length(min=6, max=30)])
+         wtforms.validators.Length(min=6, max=30)],
+        id="password")
 
 
 class EditAttachmentsForm(wtforms.Form):
index 3517b5c310d659376ecad098e6f0cbcde80207cd..44b27bb82432b396c7dffd8047294540fb894c64 100644 (file)
@@ -19,7 +19,7 @@
 {# Generically render a field #}
 {% macro render_field_div(field) %}
   {% if field.label.text -%}
-    <p class="form_field_label"><label for="{{ field.name }}">{{ _(field.label.text) }}</label></p>
+    <p class="form_field_label"><label for="{{ field.label.field_id }}">{{ _(field.label.text) }}</label></p>
   {%- endif %}
   <div class="form_field_input">
     {{ field }}