I am using a custom EMAIL_BACKEND. The email setup is successful. I can get the email in my own email account.
When I use the password reset form, I can also get the email in my own account. This is how I did it. I specify a view:
path(route="accounts/password_reset/",
view=home_views.my_password_reset_view,
name="my_password_reset_view"),
In my view, I perform the send_mail():
send_mail(subject=password_reset_subject,
message=password_reset_email,
from_email=from_email,
recipient_list=[user_email],
html_message=password_reset_email,
)
In the reset_link, I set the following:
protocol = "http"
domain = request.get_host()
reset_link = (f"{protocol}://{domain}/accounts/reset/{uidb64}/{token}/")
password_reset_email = format_html(
"<html>... <a href='{}'>Reset password page</a></html>", reset_link
)
password_reset_subject = "Password reset request"
The password_reset_email is a string that I set. The registrations/password_reset_email.html will give errors about the template.
But, the problem is with the uid and token. I don’t know to get the uid and the token.
Do you have any idea how to obtain the uid and the token?