Django all auth:如何覆盖确认电子邮件 url

Oot*_*oto 4 django single-page-application django-rest-framework django-allauth django-rest-auth

我想要做的是覆盖templates/account/email/email_confirmation_message.txt.

我想改变这部分

To confirm this is correct, go to {{ activate_url }}
Run Code Online (Sandbox Code Playgroud)

http://localhost:8080/confirm_email/{{ key }}
Run Code Online (Sandbox Code Playgroud)

然而,我无法弄清楚{{ activate_url }}从哪里来。我想将 发送key到由rest-auth.

如何重写电子邮件上的 url 链接?或者如果它太复杂了,在前端验证电子邮件的简单方法是什么?

dir*_*ten 5

模板呈现与含有一个上下文usercurrent_siteactivate_urlkey(见send_confirmation_mail()在方法allauth /帐户/ adapter.py)。

因此,您可以覆盖模板并使用key(也可能是current_site创建绝对 URI)在模板中创建您的 URL。