I set the redirect url of AccountAdapter to this
def get_login_redirect_url(self, request):
user_ = get_object_or_None(User, email=request.user )
if user_.has_usable_password():
pass
else:
url = '/accounts/password/set/'
return resolve_url(url)
But upon setting the password, it redirects the user to the password change view.
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)
Most helpful comment
@shepherd1530 To solve this problem, I inherited from PasswordChangeView, like this:
Then, in my
urls.py, I added the following line:Hope this helps!