Reputation: 365
I have a custom authentication model that contains a uuid
field. In case the user forgets his password, a link will be sent to his email that will allow him to reset the password. The link contains the uuid
. The form contains only password1
and password2
fields.
Is there any way to change the password when user is not logged in ?(auth.authenticate
cannot be used as the user does not remember his/her password.)
If not, I want to authenticate using his email
and uuid
itself. How can it be done?
Upvotes: 0
Views: 225
Reputation: 599788
This functionality is built into Django. See the password reset view and the subsequent reset_done and reset_confirm views.
Submitting the form in the initial view will email a one-time link to the user, which when clicked will display a form allowing them to enter a new password without knowing the old one.
Upvotes: 1