1
Google 팀은 백엔드에서 django-rest-api로 프로젝트를 진행하고 프론트 엔드에서 반응합니다. 인증을 위해 django-rest-auth를 사용하며 비밀번호 재설정에 문제가 있습니다. 은 다음의 URL :django-rest-auth 재설정 비밀번호 uid 및 토큰
password_reset하는 요청이 게시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')),
]
는 사용자가 링크와 이메일을 수신 UID 및 토큰이 포함되어 있습니다. 그런 다음 사용자가 양식을 반응에 여기서 new_password을 채우고, 우리는 데이터를 게시하려면 :/
{
"new_password1": "new_password",
"new_password2": "new_password",
"uid": "",
"token": ""
}
에/나머지 - 인증/암호/확인 /를 재설정합니다.
이 url에서 비밀번호 재설정을 확인한 후 make 페이지의 프론트 엔드에서이 uid와 토큰을 얻은 다음 비밀번호 변경 확인을 위해 데이터를 게시 할 수 있습니까?
페이지 URL에서 uid와 토큰을 가져갈 수 없습니까? 이것이 Django의 비슷한 내장 기능이하는 방식입니다. 자바 스크립트로 URL을 가져올 수 있습니다. 암호 재설정 토큰의 실제 구현은 다음과 같습니다. https :// gj / –