我正在尝试使用django-rest-auth在本地主机上测试密码重置配置。电子邮件验证和注册工作正常,我可以触发密码重置事件并发送电子邮件,但是电子邮件包含错误的域。目前,它正在传递包含my-site.com
作为域而不是0.0.0.0:8000
作为域的链接。我在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
我用于注册的网址文件是:
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')),
]
我遇到了另一条建议更改站点ID的帖子,但是我不确定这是正确的。
如何让它传递当前提供服务的域而不是站点ID域?