How to enable reset password for users with unusable password in Django?

I have a Django 1.4.3 web application. We allow users to book shows as guests; such users are created using email and an unused password (using set_unusable_password ()). Now we want to allow them to reset the password. But the built-in form of Django reset prohibits the use of reset for a user with an unusable password. Should I create my own form? What are the alternatives? Or should you use make_random_password?

The corresponding code from the auth project is

if any((user.password == UNUSABLE_PASSWORD)
           for user in self.users_cache):
            raise forms.ValidationError(self.error_messages['unusable'])

thanks

+4
source share
1 answer

PasswordResetForm reset , . , .

Django 1.8+ get_users.

Django 1.4 clean_email.

URL password_reset, kwarg password_reset_form.

+3

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


All Articles