我正在尝试使用django-rest-auth在我的localhost上测试我的密码重置配置。电子邮件验证和注册工作,我可以触发密码重置事件并发送电子邮件,但电子邮件包含错误的域。现在它传递的是包含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
我注册的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')),
]
我跑过另一篇建议更改网站ID的帖子,但我不确定这是否正确。
如何让它通过当前服务的域而不是站点ID域?