I am using allauth and after registration the user receives an email asking them to click a link to verify their email address. I would like to change the value of this link.
I would like to change it from
http://localhost:8001/account/confirm-email/hy72ozw8b1cexuw2dsx4wwrmgzbmnyxx4clswh67tcvgyovg/
to
http://localhost:8001/index.html#/verifyEmail/hy72ozw8b1cexuw2dsx4wwrmgzbmnyxx4clswh67tcvgyovg/
How can I do this? I see that activate_url
value is being used in email_confirmation_text.txt
You don't really have to override allauth
's urls.py
in order to achieve this, all you need to do is specify your version of url after including allauth
's urls:
from django.conf.urls import patterns, include, url
from allauth.account.views import confirm_email
urlpatterns = patterns('',
...
url(r'^accounts/', include('allauth.account.urls')),
url(r'^index.html#/verifyEmail/(?P<key>\w+)/$', confirm_email,
name="account_confirm_email"),
# but I would recommend changing that url:
url(r'^verify-email/(?P<key>\w+)/$', confirm_email,
name="account_confirm_email"),
...
)
Here is a nice article about URLS: Cool URIs don't change
I have not used django-allauth or incorporated it into one of my projects, but just poking around in their source code tells me the following:
The send method just does a basic urlresolvers.reverse
call, which means it's constructing the URL from account/urls.py
as defined here.
As such, you have three options:
urls.py
which you will have to repeat each time you update the package (yuck).EmailConfirmation
model, overriding their send method with something more appropriate for your project, and see if you can get it to use yours instead of theirs (no idea if this is workable or not).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With