brutasse / django-password-reset

Class-based views for password reset
https://django-password-reset.readthedocs.io
BSD 3-Clause "New" or "Revised" License
278 stars 136 forks source link

views.Reset.invalid AttributeError exception #48

Open umgelurgel opened 8 years ago

umgelurgel commented 8 years ago

Looks like the exception in https://github.com/brutasse/django-password-reset/blob/master/password_reset/views.py#L139 is thrown before Reset.user is assigned and results in a call to Reset.get_form_kwargs that tries to access Reset.user.

Exception details:

AttributeError: 'Reset' object has no attribute 'user'
  File "django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "password_reset/views.py", line 132, in dispatch
    return self.invalid()
  File "password_reset/views.py", line 138, in invalid
    return self.render_to_response(self.get_context_data(invalid=True))
  File "password_reset/views.py", line 146, in get_context_data
    ctx = super(Reset, self).get_context_data(**kwargs)
  File "django/views/generic/edit.py", line 122, in get_context_data
    kwargs['form'] = self.get_form()
  File "django/views/generic/edit.py", line 74, in get_form
    return form_class(**self.get_form_kwargs())
  File "password_reset/views.py", line 142, in get_form_kwargs
    kwargs['user'] = self.user
twoblokeswithapostie commented 7 years ago

Hi @umgelurgel, did you find a solution for this issue? It keeps getting logged in my sentry and I can't replicate it.

Cheers,

M

umgelurgel commented 7 years ago

Sorry @twoblokeswithapostie , stopped working on the project where this was the problem a while back and don't remember how was this resolved.