diff --git a/plinth/modules/networks/forms.py b/plinth/modules/networks/forms.py index 32166bfeb..7ff371c0c 100644 --- a/plinth/modules/networks/forms.py +++ b/plinth/modules/networks/forms.py @@ -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.""" diff --git a/plinth/modules/networks/templates/connections_create.html b/plinth/modules/networks/templates/connections_create.html index a42f162c8..c28737d7a 100644 --- a/plinth/modules/networks/templates/connections_create.html +++ b/plinth/modules/networks/templates/connections_create.html @@ -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);