How to clear password field after login failure?

I am using django.contrib.auth.views.login to login. When the login is not completed, the user and password fields are returned to the form.

What is the correct way to clean them?

+3
source share
1 answer

Pass render_value = False when creating the PasswordInput password field.

class YourAuthenticationForm(AuthenticationForm):
    password = forms.CharField(widget=forms.PasswordInput(render_value=False))
+4
source

Source: https://habr.com/ru/post/1737914/


All Articles