Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-08 Thread cseb...@gmail.com
Ruby Thank you very much. Can you tell me what I can do to improve my Django code? I would really appreciate as I'm always open to constructive feedback. I'm still curious why my code successfully changes the password but cannot retain the session afterwards. Thanks for all your help. Chr

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-07 Thread Ruby
Hi Chris, The quality of your code is very poor and needs to be generally improved, in the meantime, Django already has a built-in "Change Password Form" that you can use `django.contrib.auth.forms.PasswordChangeForm` ( https://github.com/django/django/blob/042b381e2e37c0c37b8a8f6cc9947f1a2ebfa0dd/

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-07 Thread cseb...@gmail.com
Ruby Thank you very much. I tried adding the request argument to my form subclass and got this... AttributeError: 'WSGIRequest' object has no attribute 'get' I don't understand how/why tweaking my form this way will solve the session issue. My form only gets the new password from the user.

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-07 Thread cseb...@gmail.com
I wrote it myself. Why? cs On Wednesday, November 6, 2024 at 2:34:02 PM UTC-6 Ken BHHO wrote: > @cseb Where did you get that Django Code? > > On Wed, 6 Nov 2024 at 15:07, Ruby wrote: > >> Your code needs to be refactored, here is the real deal, your >> ChangePassowrdFrom is missing `request`,

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-06 Thread Ken BHHO
@cseb Where did you get that Django Code? On Wed, 6 Nov 2024 at 15:07, Ruby wrote: > Your code needs to be refactored, here is the real deal, your > ChangePassowrdFrom is missing `request`, it should be as it is below > form = grandmas4hire.forms.ChangePasswordForm(request, request.POST) > > > O

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-06 Thread Ruby
Your code needs to be refactored, here is the real deal, your ChangePassowrdFrom is missing `request`, it should be as it is below form = grandmas4hire.forms.ChangePasswordForm(request, request.POST) On Wed, Nov 6, 2024 at 8:20 PM cseb...@gmail.com wrote: > Ruby > > Thank you very much. Here i

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-06 Thread cseb...@gmail.com
Ruby Thank you very much. Here is my code... INV= grandmas4hire.models.Invitation ... def add_url_param(url, param, arg): prefix = "&" if "?" in url else "/?"

Re: django.contrib.auth.update_session_auth_hash not working after change password

2024-11-05 Thread Ruby
How was it implemented? Show a snippet from your code See how it was used in my code form = ChangePasswordForm(request, request.POST) if form.is_valid(): user = form.save() update_session_auth_hash(request, user) messages.success( request, "Your password has been successfully updated") return redi

django.contrib.auth.update_session_auth_hash not working after change password

2024-11-05 Thread cseb...@gmail.com
When I change a password, users are logged out. Django recommends keeping users logged in by calling django.contrib.auth.update_session_auth_hash(request, user). This is not working in a Django website of mine. They must log in again!? There are no error messages. Is there any way I can provide