Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'RegistrationProfile' object has no attribute 'has_usable_password' with Django 1.6.2 #7

Open
ghost opened this issue Mar 12, 2014 · 4 comments
Labels

Comments

@ghost
Copy link

ghost commented Mar 12, 2014

Hi

With the upgrade to Django 1.6.2 I found another issue:

ERROR 2014-03-11 10:32:05,235 | [...]/python2.7/site-packages/django/core/handlers/base.py:226 (in handle_uncaught_exception) | Internal Server Error: /accounts/password/reset/
Traceback (most recent call last):
File "[...]/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "[...]/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, _args, *_kwargs)
File "[...]/python2.7/site-packages/django/contrib/auth/views.py", line 158, in password_reset
form.save(**opts)
File "[...]/python2.7/site-packages/django/contrib/auth/forms.py", line 236, in save
if not user.has_usable_password():
AttributeError: 'RegistrationProfile' object has no attribute 'has_usable_password'

The solution was quite simple. In class RegistrationProfile(User) inside registration/documents.py, add

def has_usable_password(self):
return hashers.is_password_usable(self.password)

requires a from django.contrib.auth import hashers on top.

Thank you for this great app.

@lig lig added the bug label Mar 12, 2014
@lig
Copy link
Owner

lig commented Mar 12, 2014

Thank you for your report.

I think that Django 1.6 support is not a priority for this project as it is going to be superseded by https://github.com/lig/regme

@ghost
Copy link
Author

ghost commented Mar 12, 2014

Oops, I didn't know that :( Luckily this was the only other issue I found. I'll keep an eye on regme, thanks!

@ghost ghost closed this as completed Mar 12, 2014
@lig lig reopened this Mar 12, 2014
@lig
Copy link
Owner

lig commented Mar 12, 2014

The bug is still here nonetheless.

@ghost
Copy link
Author

ghost commented Mar 12, 2014

Hmm, that's debatable. The code has no problem with Django 1.5. It works out of the box, except the reset view, but that comes from the Django core, [1], which expects User.id to be an integer in django.contrib.auth's pasword reset feature. This is the reason for my upgrade, indeed, the bug was solved in Django 1.6.

[1] https://code.djangoproject.com/ticket/14881

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant