Our team works on project with django-rest-api on backend and react on frontend. For authentication we use django-rest-auth, and we have problem with password reset. Here urls:
urlpatterns += [
url(r'^accounts/', include('allauth.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^api/', include('api.urls')),
url(r'^rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
url(
r'^rest-auth/password/reset/$',
PasswordResetView.as_view(),
name='password_reset',
),
url(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'),
url(
r'^rest-auth/registration/account-confirm-email/(?P<key>[-:\w]+)/$',
confirm,
name="account_confirm_email"
),
url(r'^', include('core.urls', namespace='core')),
]
When request to password_reset is posted, user receives email with link contains uid and token. Then user fills new_password in react form, and we want post data:
{
"new_password1": "new_password",
"new_password2": "new_password",
"uid": "",
"token": ""
}
to /rest-auth/password/reset/confirm/.
How we may to obtain this uid and token on frontend for make page with confirm password reset on this url, and then post data for confirm password change?