I wanted to use djoser
for the reset password functionality and as per the documentation:
PASSWORD_RESET_CONFIRM_URL
URL to your frontend password reset page. It should contain {uid} and {token} placeholders, e.g.
#/password-reset/{uid}/{token}
. You should pass uid and token to reset password confirmation endpoint.
I have done the following:
PASSWORD_RESET_CONFIRM_URL': 'reset/password/reset/confirm/{uid}/{token}',
url
url(r'^reset/password/reset/confirm/(?P<uid>[\w-]+)/(?P<token>[\w-]+)/$', PasswordResetView.as_view(),),
View :
class PasswordResetView(APIView):
def get (self, request, uid, token):
post_data = {'uid': uid, 'token': token}
return Response(post_data)
In my mail I get this link : http://127.0.0.1:8000/reset/password/reset/confirm/Mjk/538-954dccbc1b06171eff4d
This is obvious that I will get :
{
"uid": "Mjk",
"token": "538-954dccbc1b06171eff4d"
}
as my output but I wanted to go to auth/password/reset/confirm
when the user clicks the link in the mail.
auth/password/reset/confirm
? So why not just put it in the PASSWORD_RESET_CONFIRM_URL setting? It should work straight away. – Kamil Niskiauth/password/reset/confirm
in the email then I won't get the uid and token to know who the user is . Andauth/password/reset/confirm
is aPOST
url whose fields areuid
,token
, andnew_password
– Bishwa Karki