django - django-rest-auth password reset sending wrong domain in email
问题描述
I'm trying to test my password reset configuration on my localhost using django-rest-auth. The email verification and registration work, and I can trigger a password reset event and send an email, but the email contains the wrong domain. Right now it is passing a link containing my-site.com
as the domain instead of 0.0.0.0:8000
as the domain. I am running the app inside a docker container which is why it is 0.0.0.0:8000
instead of 127.0.0.1:8000
.
Current result:
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
Expected result
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
My url file for my registration is:
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')),
]
I ran across another post that suggested changing the site id, but I'm not sure this is correct.
How do I get it to pass the currently served domain instead of the site id domain?
解决方案
推荐阅读
- elasticsearch - 将每个文档与 Elasticsearch 中的搜索参数要满足的功能相关联
- php - 用其他值的数组替换字符串中的值
- javascript - 为什么我必须在这个聊天应用程序中不断触发 GET 请求?
- .net-core - 构建所有 csproj 文件,除了测试项目
- javascript - 在类外调用函数与在类内调用函数有什么区别?
- ios - 错误消息 - 在 iOS 上未原生找到 RNFirebase 核心模块
- python-3.x - 如何将字符串 Serie 转换为带时间和不带时间的日期时间
- c# - 当 iOS 应用程序后台运行时,HttpClient Web 服务请求被取消
- c++ - 用while循环替换for循环
- amazon-web-services - 如何比较两个 AWS Rekognition 集合?