Tivix / django-rest-auth

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
www.tivix.com
MIT License
2.4k stars 662 forks source link

Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name. #651

Open vahidkoohkan opened 2 years ago

vahidkoohkan commented 2 years ago

Hi! This error occurs when the email is entered correctly: django.urls.exceptions.NoReverseMatch: Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name. And when the wrong email is entered, this response will be returned:

{
    "detail": "Password reset e-mail has been sent."
}

(The result was the same in both logged in and logged out modes)

a part of my code:

from django.urls import include, path

urlpatterns = [
    path('rest-auth/', include('rest_auth.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls')),

I also tried this code but it was not useful:

from django.urls import include, path, re_path
from rest_auth.views import PasswordResetConfirmView

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'),

django-rest-auth == 0.9.5 Django == 3.2.9 python == 3.9.0

mikiyas-Haile commented 2 years ago

Add this pattern, It worked for me.

from django.urls import include, path, re_path
from rest_auth.views import PasswordResetConfirmView
urlpatterns = [
# ...
        path('rest-auth/password/reset/confirm/<str:uidb64>/<str:token>', PasswordResetConfirmView.as_view(),
            name='password_reset_confirm'),
# ..
]
swalih-mohammed commented 2 years ago

solved mine too

Rahmani21 commented 2 years ago

Add this pattern, It worked for me.

from django.urls import include, path, re_path
from rest_auth.views import PasswordResetConfirmView
urlpatterns = [
# ...
        path('rest-auth/password/reset/confirm/<str:uidb64>/<str:token>', PasswordResetConfirmView.as_view(),
            name='password_reset_confirm'),
# ..
]

Still not workink

elinteerie commented 1 year ago

did not work for me

SiddhantTotade commented 10 months ago

Hi! This error occurs when the email is entered correctly: django.urls.exceptions.NoReverseMatch: Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name. And when the wrong email is entered, this response will be returned:

{
    "detail": "Password reset e-mail has been sent."
}

(The result was the same in both logged in and logged out modes)

a part of my code:

from django.urls import include, path

urlpatterns = [
    path('rest-auth/', include('rest_auth.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls')),

I also tried this code but it was not useful:

from django.urls import include, path, re_path
from rest_auth.views import PasswordResetConfirmView

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'),

django-rest-auth == 0.9.5 Django == 3.2.9 python == 3.9.0

I am also having the same issue. when i pass an incorrect email in password/reset then it shows success message Password reset e-mail has been sent. but when i pass the actual email which exist in the database it throws error.

Why is this happening? someone tell me

urlpatterns = [
    path("admin/", admin.site.urls),
    path("auth/", include("dj_rest_auth.urls")),
    path("auth/registration/", include("dj_rest_auth.registration.urls")),
    path("auth/password/reset", PasswordResetView.as_view(), name="rest_password_reset"),
    path("auth/registration/account-confirm-email/<str:key>/", redirect_email_confirm, name="account_email_verification_sent"),
    path("auth/reset/passowrd/confirm/<int:uid>/<str:token>/", reset_password_confirm, name="password_reset_confirm"),
    path('auth/google/', GoogleLogin.as_view(), name='google_login'),
]
Rahmani21 commented 10 months ago

Ok I’ll check

On Sat, 2 Dec 2023 at 1:05 AM Siddhant Totade @.***> wrote:

Hi! This error occurs when the email is entered correctly: django.urls.exceptions.NoReverseMatch: Reverse for 'password_reset_confirm' not found. 'password_reset_confirm' is not a valid view function or pattern name. And when the wrong email is entered, this response will be returned:

{ "detail": "Password reset e-mail has been sent." }

(The result was the same in both logged in and logged out modes)

a part of my code:

from django.urls import include, path

urlpatterns = [ path('rest-auth/', include('rest_auth.urls')), path('rest-auth/registration/', include('rest_auth.registration.urls')),

I also tried this code but it was not useful:

from django.urls import include, path, re_path from rest_auth.views import PasswordResetConfirmView

repath(r'^rest-auth/password/reset/confirm/(?P[0-9A-Za-z-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', PasswordResetConfirmView.as_view(), name='password_reset_confirm'),

django-rest-auth == 0.9.5 Django == 3.2.9 python == 3.9.0

I am also having the same issue. when i pass an incorrect email in password/reset then it shows success message Password reset e-mail has been sent. but when i pass the actual email which exist in the database it throws error.

Why is this happening? someone tell me

urlpatterns = [ path("admin/", admin.site.urls), path("auth/", include("dj_rest_auth.urls")), path("auth/registration/", include("dj_rest_auth.registration.urls")), path("auth/password/reset", PasswordResetView.as_view(), name="rest_password_reset"), path("auth/registration/account-confirm-email//", redirect_email_confirm, name="account_email_verification_sent"), path("auth/reset/passowrd/confirm///", reset_password_confirm, name="password_reset_confirm"), path('auth/google/', GoogleLogin.as_view(), name='google_login'), ]

— Reply to this email directly, view it on GitHub https://github.com/Tivix/django-rest-auth/issues/651#issuecomment-1836741852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBL3E7CAQM2DEVSKU4LZHLYHI5QBAVCNFSM5LXITXY2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBTGY3TIMJYGUZA . You are receiving this because you commented.Message ID: @.***>

NistorDorin commented 1 month ago

Hello!

Do you have a solution for this issue apart from the ones mentioned above?

I'm having the same error:

Django.urls.exceptions.NoReverseMatch: Reverse for 'password_resetconfirm' with arguments '('MO', 'bwachb-fa5e0484e188dc3332573f3eedf2dd11')' not found. 1 pattern(s) tried: ['en/password-reset-confirm/(?P[0-9A-Za-z\-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$']

I have tried different patterns with and without regex : 'password-reset-confirm/', 'password-reset/confirm/', 'password/reset/confirm/', and all the above starting with 'auth' or'rest_auth'

a part of code

"urlpatterns += i18n_patterns( ... repath(r'^password-reset-confirm/(?P[0-9A-Za-z-]+)/(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.PasswordResetConfirmView.as_view(template_name='app_name/registration/password_reset_confirm.html', success_url=reverse_lazy('app_name/registration/password_reset_complete.html')), name='password_reset_confirm'), ...."

Thank you!

MMDPROJECT commented 1 month ago

@mikiyas-Haile Thanks dude, It worked for me