[Django]-Email confirm error rest-auth

6👍

I think I found your problem.

This url:

/rest-auth/registration/account-confirm-email/MTU:1bn1OD:dQ_mCYi6Zpr8h2aKS9J9BvNdDjA/

is not matched by this pattern:

url(r'^rest-auth/registration/account-confirm-email/(?P<key>\w+)/$', allauthemailconfirmation, name="account_confirm_email"), 

but by the following:

url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),

and if you look at the source code of rest_auth.registration.urls, you will see this code:

# This url is used by django-allauth and empty TemplateView is
# defined just to allow reverse() call inside app, for example when email
# with verification link is being sent, then it's required to render email
# content.

# account_confirm_email - You should override this view to handle it in
# your API client somehow and then, send post to /verify-email/ endpoint
# with proper key.
# If you don't want to use API on that step, then just use ConfirmEmailView
# view from:
# django-allauth https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py#L190
url(r'^account-confirm-email/(?P<key>[-:\w]+)/$', TemplateView.as_view(), name='account_confirm_email'),

So, you should overwrite this view, or you will get the error you’ve got, as explained here: https://github.com/Tivix/django-rest-auth/issues/20

You have indeed tried to overwrite the view, but your matching pattern is wrong, the : char causes it to fail, so let’s try something like

url(r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$', allauthemailconfirmation, name="account_confirm_email"), 

The relevant part being: (?P[-:\w]+)/$

Leave a comment