django-rest-auth 密码重置在电子邮件中发送错误的域
django-rest-auth password reset sending wrong domain in email
我正在尝试使用 django-rest-auth 在我的本地主机上测试我的密码重置配置。电子邮件验证和注册有效,我可以触发密码重置事件并发送电子邮件,但电子邮件包含错误的域。现在它正在传递一个包含 my-site.com
作为域而不是 0.0.0.0:8000
作为域的 link。我是 运行 docker 容器内的应用程序,这就是为什么它是 0.0.0.0:8000
而不是 127.0.0.1:8000
。
当前结果:
You're receiving this email because you requested a password reset for your user account at My Site.
Please go to the following page and choose a new password:
http://my-site.com/auth/password-reset/confirm/OA/55d-7dc2614593146ac3ce82/
Your username, in case you've forgotten: testaccount
Thanks for using our site!
The My Site team
预期结果
You're receiving this email because you requested a password reset for your user account at My Site.
Please go to the following page and choose a new password:
http://0.0.0.0:8000/auth/password-reset/confirm/OA/55d-7dc2614593146ac3ce82/
Your username, in case you've forgotten: testaccount
Thanks for using our site!
The My Site team
我的 url 注册文件是:
from django.urls import path, include
from allauth.account.views import ConfirmEmailView
from . import views
urlpatterns = [
path('registration/account-email-verification-sent/', views.null_view, name='account_email_verification_sent'),
path('registration/account-confirm-email/<key>', ConfirmEmailView.as_view(), name='account_confirm_email'),
path('registration/complete/', views.complete_view, name='account_confirm_complete'),
path('password-reset/confirm/(<uidb64>/<token>/', views.null_view, name='password_reset_confirm'),
path('', include('rest_auth.urls')),
path('registration/', include('rest_auth.registration.urls')),
]
我 运行 另一个 post 建议更改站点 ID,但我不确定这是正确的。
如何让它传递当前服务的域而不是站点 ID 域?
简单的解决方案
第 1 步: 转到 /admin/sites/site/
,您会看到类似如下的内容,
第 2 步:使用以下值编辑现有条目然后保存
域名:0.0.0.0:8000
显示名称:您的网站名称
我正在尝试使用 django-rest-auth 在我的本地主机上测试我的密码重置配置。电子邮件验证和注册有效,我可以触发密码重置事件并发送电子邮件,但电子邮件包含错误的域。现在它正在传递一个包含 my-site.com
作为域而不是 0.0.0.0:8000
作为域的 link。我是 运行 docker 容器内的应用程序,这就是为什么它是 0.0.0.0:8000
而不是 127.0.0.1:8000
。
当前结果:
You're receiving this email because you requested a password reset for your user account at My Site.
Please go to the following page and choose a new password:
http://my-site.com/auth/password-reset/confirm/OA/55d-7dc2614593146ac3ce82/
Your username, in case you've forgotten: testaccount
Thanks for using our site!
The My Site team
预期结果
You're receiving this email because you requested a password reset for your user account at My Site.
Please go to the following page and choose a new password:
http://0.0.0.0:8000/auth/password-reset/confirm/OA/55d-7dc2614593146ac3ce82/
Your username, in case you've forgotten: testaccount
Thanks for using our site!
The My Site team
我的 url 注册文件是:
from django.urls import path, include
from allauth.account.views import ConfirmEmailView
from . import views
urlpatterns = [
path('registration/account-email-verification-sent/', views.null_view, name='account_email_verification_sent'),
path('registration/account-confirm-email/<key>', ConfirmEmailView.as_view(), name='account_confirm_email'),
path('registration/complete/', views.complete_view, name='account_confirm_complete'),
path('password-reset/confirm/(<uidb64>/<token>/', views.null_view, name='password_reset_confirm'),
path('', include('rest_auth.urls')),
path('registration/', include('rest_auth.registration.urls')),
]
我 运行 另一个 post 建议更改站点 ID,但我不确定这是正确的。
如何让它传递当前服务的域而不是站点 ID 域?
简单的解决方案
第 1 步: 转到 /admin/sites/site/
,您会看到类似如下的内容,
第 2 步:使用以下值编辑现有条目然后保存
域名:0.0.0.0:8000
显示名称:您的网站名称