Password change view throws 500 if unauthenticated #703

Closed
opened 2022-06-21 13:07:31 +02:00 by tteichler · 6 comments
Owner
Internal Server Error: /accounts/password/change/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/contrib/auth/mixins.py", line 104, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/decorators/debug.py", line 89, in sensitive_post_parameters_wrapper
    return view(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/allauth/account/views.py", line 592, in dispatch
    return super(PasswordChangeView, self).dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/allauth/account/views.py", line 90, in get
    response = super(AjaxCapableProcessFormViewMixin, self).get(
  File "/usr/local/lib/python3.9/dist-packages/django/views/generic/edit.py", line 133, in get
    return self.render_to_response(self.get_context_data())
  File "/usr/local/lib/python3.9/dist-packages/allauth/account/views.py", line 595, in render_to_response
    if not self.request.user.has_usable_password():
  File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 247, in inner
    return func(self._wrapped, *args)
  File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 247, in inner
    return func(self._wrapped, *args)
  File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 247, in inner
    return func(self._wrapped, *args)
AttributeError: 'AnonymousUser' object has no attribute 'has_usable_password'

The View should redirect to the login page if user is unauthenticated.

``` Internal Server Error: /accounts/password/change/ Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python3.9/dist-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/contrib/auth/mixins.py", line 104, in dispatch return super().dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/views/decorators/debug.py", line 89, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/allauth/account/views.py", line 592, in dispatch return super(PasswordChangeView, self).dispatch(request, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/views/generic/base.py", line 98, in dispatch return handler(request, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/allauth/account/views.py", line 90, in get response = super(AjaxCapableProcessFormViewMixin, self).get( File "/usr/local/lib/python3.9/dist-packages/django/views/generic/edit.py", line 133, in get return self.render_to_response(self.get_context_data()) File "/usr/local/lib/python3.9/dist-packages/allauth/account/views.py", line 595, in render_to_response if not self.request.user.has_usable_password(): File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 247, in inner return func(self._wrapped, *args) File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 247, in inner return func(self._wrapped, *args) File "/usr/local/lib/python3.9/dist-packages/django/utils/functional.py", line 247, in inner return func(self._wrapped, *args) AttributeError: 'AnonymousUser' object has no attribute 'has_usable_password' ``` The View should redirect to the login page if user is unauthenticated.
Owner

assigned to @debdolph

assigned to @debdolph
Owner

changed due date to June 22, 2022

changed due date to June 22, 2022
Owner

assigned to @yuha and unassigned @debdolph

assigned to @yuha and unassigned @debdolph
Member

created branch 703-password-change-view-throws-500-if-unauthenticated to address this issue

created branch [`703-password-change-view-throws-500-if-unauthenticated`](/AlekSIS/official/AlekSIS-Core/-/compare/master...703-password-change-view-throws-500-if-unauthenticated) to address this issue
Member

mentioned in merge request !2696

mentioned in merge request !2696
nik closed this issue 2022-06-22 22:08:55 +02:00
Owner

mentioned in commit 045110bc54

mentioned in commit 045110bc540e1064f738f41b51f2983ea9f0fbda
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aleksis/AlekSIS-Core#703
No description provided.