如何编辑Django用户验证电子邮件链接

huangapple go评论65阅读模式
英文:

How to Edit the Django User Verification Email Link

问题

My Django User Verification Email Link starts with http

Below is an example:

链接示例:http://examplesitexxx.com/accounts/confirm-email/MTA:1poGIh:x7zOj4350ZP6uLhT0wUEp1CRE13jWrvRanofpFgTBkw/

I want to change the Verification URL that starts with 'https'.

So I access the file allauth/templates/account/email/email_confirmation_message.txt.

In this file I see {{ activate_url }}.

It should be a source of Verification Email URL but I can't figure out how to change the activate_url that starts from https to http.

I just mentioned the above settings in this question but still if more code is required then tell me I'll update my question with that information.

英文:

My Django User Verification Email Link starts with http

Below is an example:

http://examplesitexxx.com/accounts/confirm-email/MTA:1poGIh:x7zOj4350ZP6uLhT0wUEp1CRE13jWrvRanofpFgTBkw/

I want to change the Verification URL that starts with 'https'.

So I access the file allauth/templates/account/email/email_confirmation_message.txt.

In this file I see {{ activate_url }}.

It should be a source of Verification Email URL but I can't figure out how to change the activate_url that start from https from http.

I just mentioned the above settings in this question but still if more code is required then tell me I'll update my question with that information.

答案1

得分: 0

你可以在你的Django项目设置文件(settings.py)中更新ACCOUNT_DEFAULT_HTTP_PROTOCOL设置。我几周前已经完成了这个操作。

将以下行添加到你的settings.py文件中:

ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"

这将把allauth应用程序使用的默认HTTP协议从"http"更改为"https"。然后,email_confirmation_message.txt模板中的activate_url变量将使用更新后的默认协议。

当然,确保你的Django项目在HTTPS上运行。

英文:

you can update the ACCOUNT_DEFAULT_HTTP_PROTOCOL setting in your Django project settings file (settings.py).
I done this few weeks ago.

Add the following line to your settings.py file:

ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"

This will change the default HTTP protocol used by the allauth app from "http" to "https". The activate_url variable in the email_confirmation_message.txt template will then use the updated default protocol.

Obviously, ensure that your Django project is running over HTTPS.

huangapple
  • 本文由 发表于 2023年4月17日 14:11:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76032134.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定