From 8e4a5ef39a81c8c42f04e6cf68c09259881a9153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sat, 17 Aug 2019 11:59:40 +0200 Subject: [PATCH] forms: mark fields expecting a new password (#26385) --- src/authentic2/forms/widgets.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/authentic2/forms/widgets.py b/src/authentic2/forms/widgets.py index 297bfe20e..9ec35723a 100644 --- a/src/authentic2/forms/widgets.py +++ b/src/authentic2/forms/widgets.py @@ -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')