forms: mark fields expecting a new password (#26385)

This commit is contained in:
Frédéric Péters 2019-08-17 11:59:40 +02:00
parent 5732f219c5
commit 8e4a5ef39a
1 changed files with 6 additions and 0 deletions

View File

@ -238,6 +238,9 @@ class PasswordInput(BasePasswordInput):
class NewPasswordInput(PasswordInput):
def render(self, name, value, attrs=None):
if attrs is None:
attrs = {}
attrs['autocomplete'] = 'new-password'
output = super(NewPasswordInput, self).render(name, value, attrs=attrs)
if attrs:
_id = attrs.get('id')
@ -250,6 +253,9 @@ class CheckPasswordInput(PasswordInput):
# this widget must be named xxx2 and the other widget xxx1, it's a
# convention, js code expect it.
def render(self, name, value, attrs=None):
if attrs is None:
attrs = {}
attrs['autocomplete'] = 'new-password'
output = super(CheckPasswordInput, self).render(name, value, attrs=attrs)
if attrs:
_id = attrs.get('id')