0

I am trying to implement password_reset (message sending to user for reset his password), but after writing email, nothing has send and the user is redirected to home...

My view.py :

...

from django.contrib.auth.views import password_reset, password_reset_confirm

# Import the render shortcut to render the templates in response.
from django.shortcuts import render

# This view handles the password reset form URL /.
def reset(request):
    return password_reset(request, template_name='le_site/reset.html',
    email_template_name='le_site/password_reset_email.html',
    subject_template_name='le_site/mdp-oublie_texte.txt ',
    post_reset_redirect=reverse('success'))

# This view handles password reset confirmation links. See urls.py file for the mapping.
# This view is not used here because the password reset emails with confirmation links
# cannot be sent from this application.
def reset_confirm(request, uidb64=None, token=None):
    return password_reset_confirm(request, template_name='le_site/password_reset_confirm.html',
    uidb36=uidb36, token=token, post_reset_redirect=reverse('success'))

# This view renders a page with success message.
def success(request):
  return render(request, "le_site/password_reset_complete.html")

...

My urls.py :

from mysite.views import reset
...
url(r'reset$', 'reset', name='reset'), 
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
        'reset_confirm', name='password_reset_confirm'),
url(r'^success/$', 'success', name='success'),
...

I know it's not important but I write directly http://localhost:8000/reset for access to the reset form page.

Why It doesn't works ? :( Why nothing is sent ? Why I am redirect to home page ?

Thank's

Serjik
  • 10,543
  • 8
  • 61
  • 70
Zoulou
  • 303
  • 2
  • 16
  • Nobody can help me ? I test in the terminal 'send_mail' and it's works (return 1 and I checked my emails). Do you want further informations ? – Zoulou Nov 14 '15 at 10:36
  • there's a catch here. Does the email you are entering, belong to a user? If the email address provided does not exist in the system, this view won’t send an email, but the user won’t receive any error message either. This prevents information leaking to potential attackers. – utkbansal Nov 15 '15 at 17:43

0 Answers0