mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
show / hide password box
Added a selectbox to change the input box type from password to text.
This commit is contained in:
parent
286caf8917
commit
d79437d2a2
@ -87,7 +87,10 @@ class AddPPPoEForm(forms.Form):
|
||||
available over this interfaces. Select Internal only for trusted networks.'),
|
||||
choices=[('external', 'External'), ('internal', 'Internal')])
|
||||
username = forms.CharField(label=_('Username'))
|
||||
password = forms.CharField(label=_('Password'))
|
||||
password = forms.CharField(label=_('Password'),
|
||||
widget=forms.PasswordInput())
|
||||
showpw = forms.BooleanField(label=_('show password'),
|
||||
required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize the form, populate interface choices."""
|
||||
|
||||
@ -58,6 +58,20 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#id_showpw').change(function() {
|
||||
//changing type attribute from password to text is prevented by
|
||||
//most browsers make a new form field works for me
|
||||
if ($('#id_showpw').prop('checked')) {
|
||||
$('#id_password').replaceWith(
|
||||
$('#id_password').clone().attr(
|
||||
'type', 'text'));
|
||||
} else {
|
||||
$('#id_password').replaceWith(
|
||||
$('#id_password').clone().attr(
|
||||
'type', 'password'));
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user