Cloud Artisans
Cloud Artisans

Reputation: 4136

In django-rest-auth, the password reset confirm URL doesn't work--is it missing arguments?

If you look at urlpatterns in django.contrib.auth.urls, the password_reset_confirm URL takes uidb64 and token params, which makes sense--when clicked on, this will identify the user resetting the password. However, django-rest-auth's rest_password_reset_confirm URL doesn't take any arguments: it just goes to password/reset/confirm/. How can it work? I get the following 500 error when submitting my email to reset my password, and I'm not surprised--the error makes sense:

NoReverseMatch: Reverse for 'password_reset_confirm' with arguments '()' and keyword arguments '{u'uidb64': 'NA', u'token': u'4lj-65cd7b4219c9206126b4'}' not found.

What I don't understand is it seems like such a basic thing that I must be doing something wrong--otherwise everyone using django-rest-auth would get this error because the arguments are clearly missing in the URL definition. Has anyone else experienced it and if so, did you update the URL to fix it?

UPDATE: It looks like django-rest-auth, by default, simply uses native Django's contrib/admin/templates/registration/password_reset_email.html template.

Upvotes: 0

Views: 692

Answers (2)

Cloud Artisans
Cloud Artisans

Reputation: 4136

Turns out there's a simple one-line fix--add this to your base url patterns:

url(r'^', include('django.contrib.auth.urls')),

Upvotes: 3

Sijan Bhandari
Sijan Bhandari

Reputation: 3051

I have used following once in my template:

{% url 'django.contrib.auth.views.password_reset_confirm' uidb64=uid token=token %}

And, it works fine. Can you please show your template include structure?

Upvotes: 0

Related Questions