Hi Everyone,
I got stucked with triggering password reset in my custom view. I want to
trigger it in different places but I want to use the OOTB souliton. I've
found that I can import and use
from django.contrib.auth.forms import PasswordResetForm
and
from django.contrib.auth.views import password_reset
but it didn't send any email. I wasn't able to see any emails using the
console email debugger option in the settings.
I've tried these ways:
def reset_password(request):
reset_form = PasswordResetForm({'email': request.POST.get('email')})
assert reset_form.is_valid()
reset_form.save(
request=request,
use_https=request.is_secure(),
subject_template_name='registration/account_creation_subject.txt',
email_template_name='registration/account_creation_email.html',
)
return HttpResponse("the given mail: " + request.POST.get('email'))
def reset_password (request):
return password_reset(request,
post_reset_redirect="/admin/accounts/list/")
Could anyone help me to triggering password reset from my views?
Thanks in advance,
Álmos
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CADFq4vXJ6Fq4Mf0j0QcCO-H%3DHoTd16w4TSkF8AUronVOgBVvNw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.