Skip to content

Commit

Permalink
fix: Disable autocomplete in some forms (#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Nov 3, 2023
1 parent 93dbb95 commit 925b5c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions portal/forms/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ def __init__(self, user, *args, **kwargs):
super(TeacherPasswordResetSetPasswordForm, self).__init__(user, *args, **kwargs)
self.fields["new_password1"].help_text = "Enter your new password"
self.fields["new_password1"].widget.attrs["placeholder"] = "New password"
self.fields["new_password1"].widget.attrs["autocomplete"] = "off"
self.fields["new_password2"].help_text = "Confirm your new password"
self.fields["new_password2"].widget.attrs["placeholder"] = "Confirm password"
self.fields["new_password2"].widget.attrs["autocomplete"] = "off"

def clean_new_password1(self):
return form_clean_password(self, "new_password1", PasswordStrength.TEACHER)
Expand All @@ -30,8 +32,10 @@ def __init__(self, user, *args, **kwargs):
super(StudentPasswordResetSetPasswordForm, self).__init__(user, *args, **kwargs)
self.fields["new_password1"].help_text = "Enter your new password"
self.fields["new_password1"].widget.attrs["placeholder"] = "New password"
self.fields["new_password1"].widget.attrs["autocomplete"] = "off"
self.fields["new_password2"].help_text = "Confirm your new password"
self.fields["new_password2"].widget.attrs["placeholder"] = "Confirm password"
self.fields["new_password2"].widget.attrs["autocomplete"] = "off"

def clean_new_password1(self):
return form_clean_password(self, "new_password1", PasswordStrength.INDEPENDENT)
Expand Down
4 changes: 2 additions & 2 deletions portal/forms/teach.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ class TeacherSetStudentPass(forms.Form):
password = forms.CharField(
label="New password",
help_text="Enter new password",
widget=forms.PasswordInput(attrs={"placeholder": "Enter new password"}),
widget=forms.PasswordInput(attrs={"autocomplete": "off", "placeholder": "Enter new password"}),
)
confirm_password = forms.CharField(
label="Confirm new password",
help_text="Confirm new password",
widget=forms.PasswordInput(attrs={"placeholder": "Confirm new password"}),
widget=forms.PasswordInput(attrs={"autocomplete": "off", "placeholder": "Confirm new password"}),
)

def clean_password(self):
Expand Down

0 comments on commit 925b5c2

Please sign in to comment.