在django allauth

时间:2018-06-22 06:41:16

标签: python django authentication django-allauth

正在从模板 email_confirmation_message.txt

发送电子邮件
{% load account %}{% user_display user as user_display %}{% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Hello from {{ site_name }}!

You're receiving this e-mail because user {{ user_display }} has given yours as an e-mail address to connect their account.

To confirm this is correct, go to {{ activate_url }}
{% endblocktrans %}{% endautoescape %}
{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you from {{ site_name }}!
{{ site_domain }}{% endblocktrans %}

activate_url发送的链接为http://web/en/accounts/confirm-email/Mjc:1fWFRw:q-ScRb0Wnsrrem9N7pB9iLOuPOM/,其中web是我的conatiner主机名。如何将其更改为自定义域名,而不必更改我的conatiner主机名。我正在使用 django-allauth == 0.33.0

1 个答案:

答案 0 :(得分:0)

我认为您不必更改域名。它使用您自己的站点域。

2^N来自activate_url

get_email_confirmation_url()

您可以看到代码here(allauth gihtub代码)。

,它使用allatuh.utils中的 activate_url = self.get_email_confirmation_url( ... def get_email_confirmation_url(self, request, emailconfirmation): url = reverse( "account_confirm_email", args=[emailconfirmation.key]) ret = build_absolute_uri( request, url) return ret

这是代码。

build_absolute_uri

您可以找到此代码here