开发者

How to clear password field after failed login?

开发者 https://www.devze.com 2022-12-24 09:31 出处:网络
I\'m using django.contrib.auth.views.logi开发者_运维百科n to log in users. When login is failed, the user and password fields get posted back to the form.

I'm using django.contrib.auth.views.logi开发者_运维百科n to log in users. When login is failed, the user and password fields get posted back to the form.

What's the proper way to clean those?


Pass render_value=False when you create your password field's PasswordInput widget.

class YourAuthenticationForm(AuthenticationForm):
    password = forms.CharField(widget=forms.PasswordInput(render_value=False))
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号