问题描述
我正在使用 Django allauth 作为 REST API。目前,当我请求重置密码时,Django 会向我发送包含链接的电子邮件,您必须转到该链接以验证您的电子邮件。
但我想让 Django 发送一封带有验证码的电子邮件,该验证码将另一个 api endpint 用于验证帐户?
我的代码如下:
settings.py
文件
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_required = True
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ACCOUNT_USERNAME_required = False
ACCOUNT_UNIQUE_EMAIL = True
REST_USE_JWT = True
JWT_SERIALIZER = True
和已安装的应用
[
'''
'rest_framework','rest_framework.authtoken','allauth','allauth.account','rest_auth','rest_auth.registration','''
]
这是我当前的内置视图的网址
path("api/token/",TokenObtainPairView.as_view(),name="token_obtain_pair"),path("api/token/refresh/",TokenRefreshView.as_view(),name="token_refresh"),path('rest-auth/',include('rest_auth.urls')),#for forget password api endpoint
path('rest-auth/registration/',include('rest_auth.registration.urls')),# handle the error: https://github.com/iMerica/dj-rest-auth/issues/9 # https://django-allauth.readthedocs.io/en/latest/configuration.html
path("account-inactive/",AccountInactiveView.as_view(),name="account_inactive"),re_path(r'^rest-auth/password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',PasswordResetConfirmView.as_view(),name='password_reset_confirm'),
在这种情况下,有人可以帮助我吗?如何发送验证码而不是验证链接?
我正在使用这个库:https://django-rest-auth.readthedocs.io/en/latest/
https://django-allauth.readthedocs.io/en/latest/
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)