Closed realsama closed 8 months ago
The password set view is hard coded to redirect if the user has a usable password as the user is meant to be confirming the current password before they can change it: https://github.com/pennersr/django-allauth/blob/master/allauth/account/views.py#L598
Sorry but i don't get you, why would the user need to change or reset his password when he just set it some few seconds ago.
Oh yea, sorry I misread. It is currently hard coded to basically send them there.
Alright. But is this behavior intentional or or some kind of bug, and how can it be fixed
@shepherd1530 To solve this problem, I inherited from PasswordChangeView, like this:
from allauth.account.views import PasswordChangeView as allauth_PasswordChangeView
from django.urls import reverse_lazy
class PasswordChangeView(allauth_PasswordChangeView):
success_url = reverse_lazy('home')
Then, in my urls.py
, I added the following line:
path('accounts/password/change/', PasswordChangeView.as_view(), name="account_change_password"),
Hope this helps!
Yeah, a did the same thing as @seancallaway and came here to see if someone else found it strange... I was wondering if this behavior is intentional... well, I guess I'll stick with this "patch" for now :)
im having the same issue, im trying to override 'account_change_password' but when the user write a wrong password it redirects to 'account_set_password', how can i solve this? and show the message "Please type your current password." in the form overrided (in the same template)
Same problem here--after setting a password they didn't have previously (eg. social account being disconnected), the dispatch sees a usable password and immediately sends them to change it. This doesn't make a lot of sense; if they've just set one, why would they immediately change it?
For everyone in this thread I am doing some issue triage for @pennersr.
Ok! The view here is indeed hardcoded to redirect if the user has a password that is usable. I agree that this is an odd UX.
This line is the issue. Ideally this view should take / read the next
parameter. The next best thing would be to probably redirect to LOGIN_REDIRECT_URL
.
See here for rationale: https://github.com/pennersr/django-allauth/pull/3428#issuecomment-1857935893
See https://github.com/pennersr/django-allauth/commit/088a4f1a7b9c50331b8ef4d1a03d85294eec0426 -- that introduces a get_password_change_redirect_url() adapter method. Opting for this so that projects are free to do whatever they see fit.
I set the redirect url of AccountAdapter to this
But upon setting the password, it redirects the user to the password change view.