psa-allauth icon indicating copy to clipboard operation
psa-allauth copied to clipboard

'User' object has no attribute 'validate_password'

Open baltasvejas opened this issue 10 years ago • 0 comments

From documentation http://psa.matiasaguirre.net/docs/backends/email.html there is a suggestion how to validate a password like below:

def user_password(strategy, user, is_new=False, *args, **kwargs):
    if strategy.backend.name != 'email':
        return

    password = strategy.request_data()['password']
    if is_new:
        user.set_password(password)
        user.save()
    elif not user.validate_password(password):
        # return {'user': None, 'social': None}
        raise AuthException(strategy.backend)

When I try to utilize code

user.validate_password(password):

I get an error:

AttributeError at /complete/email/
'User' object has no attribute 'validate_password'

Any suggestion on this issue?

baltasvejas avatar Oct 27 '14 14:10 baltasvejas