V
V
Vic Shostak2018-02-17 20:25:47
Django
Vic Shostak, 2018-02-17 20:25:47

Django. How to (programmatically) generate a reset password link and send it to the user's email from a custom view?

Greetings!
Tell me, is it possible to generate a link that is sent to the mail when a user recovers a forgotten password from an account on the site? I will explain my case to make it clearer “why is this necessary?”.
There is a site where the user fills out forms (such as a questionnaire) and they are saved in his personal account. So, there are statistics when users, when they first visit the site, forget to register and immediately start filling out forms. Further, having discovered that the form does not allow without registration, they simply stupidly leave the site.

Due to the fact that the user enters his e-mail anyway, it was decided to make a 2-in-1 function to eliminate such cases (and not impose registration). When an anonymous user saves the form, Django automatically creates a user (with the specified e-mail and a randomly generated password), plus attaches a completed questionnaire to this account. It turns out that the wolves are full and the sheep are safe.

It would be great if after that the letter would automatically leave, as if this new user had initiated a password change (through the usual dzhang reset passwordfunctionality). Further, it is already standard - the user checks the mail, follows the link, enters a new password and enters the personal account.
I ask for good advice.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pugachev, 2018-02-21
@Stqs

I would send the generated password and in the same letter below the password change button
will want to go change it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question