0

I am able to get a verification email to the newly signed up email account. I also can verify the new email but not directly from the link sent in the email. The reason that is the confirmation link should be called with a post method, as mentioned in the documentation.

My urlpatterns list in url.py file has the two elements below:

urlpatterns = [
...,
...,
path('registration/', RegisterView.as_view(), name='account_signup'),
re_path(r'^account-confirm-email/', VerifyEmailView.as_view(),
 name='account_email_verification_sent')
]

For information I am using Django as backend with a frontend framework.

What I want is for the email verification to redirect to a page in the Frontend and from there send the post request. Is there a way to achieve this ? How to send custom email ? how to have a custom register and confirm email view ?

alpha027
  • 302
  • 2
  • 13

1 Answers1

1

You can customize the verification link - the URL in the email - by overwriting the get_email_confirmation_url

Example:

from allauth.account.adapter import DefaultAccountAdapter

class CustomAccountAdapter(DefaultAccountAdapter):

    def get_email_confirmation_url(self, request, emailconfirmation):

        """
            Changing the confirmation URL to fit the domain that we are working on
        """

        url = (
            "https://example.com/verify-account/"
            + emailconfirmation.key
        )
        return url

Also add the following line the settings.py file:

ACCOUNT_ADAPTER = "users.views.CustomAccountAdapter"

the users is the name of the app in Django that has the custom Acount adapter implemented. Documentation here for more details.

alpha027
  • 302
  • 2
  • 13
Ahmad Othman
  • 853
  • 5
  • 18