mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-10 11:00:22 +00:00
networks: Fix showing password during PPPoE edit
- Javascript was missing for the template altogether. Added one similar to create case. - Minor refactoring to existing javascript. - Consistent styling for display label and field id.
This commit is contained in:
parent
1e10fb76fc
commit
4f75f44769
@ -89,8 +89,8 @@ available over this interfaces. Select Internal only for trusted networks.'),
|
||||
username = forms.CharField(label=_('Username'))
|
||||
password = forms.CharField(label=_('Password'),
|
||||
widget=forms.PasswordInput())
|
||||
showpw = forms.BooleanField(label=_('show password'),
|
||||
required=False)
|
||||
show_password = forms.BooleanField(label=_('Show password'),
|
||||
required=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize the form, populate interface choices."""
|
||||
|
||||
@ -58,18 +58,15 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#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'));
|
||||
}
|
||||
$('#id_show_password').change(function() {
|
||||
// Changing type attribute from password to text is prevented by
|
||||
// most browsers. Making a new form field works.
|
||||
new_type = 'password';
|
||||
if ($('#id_show_password').prop('checked'))
|
||||
new_type = 'text';
|
||||
|
||||
$('#id_password').replaceWith(
|
||||
$('#id_password').clone().attr('type', new_type));
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
@ -58,6 +58,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
$('#id_show_password').change(function() {
|
||||
// Changing type attribute from password to text is prevented by
|
||||
// most browsers. Making a new form field works.
|
||||
new_type = 'password';
|
||||
if ($('#id_show_password').prop('checked'))
|
||||
new_type = 'text';
|
||||
|
||||
$('#id_password').replaceWith(
|
||||
$('#id_password').clone().attr('type', new_type));
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user