Fix change expired password feature
Closes-Bug: #1791111 Change-Id: I5f2a027149be490613e7661b895325a63374334d
This commit is contained in:
parent
b068440330
commit
c0cc0433c6
@ -21,6 +21,7 @@ from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views.decorators.debug import sensitive_variables
|
||||
|
||||
from keystoneauth1 import plugin as auth_plugin
|
||||
from openstack_auth import exceptions
|
||||
from openstack_auth import utils
|
||||
|
||||
@ -162,7 +163,7 @@ class Login(django_auth_forms.AuthenticationForm):
|
||||
return self.cleaned_data
|
||||
|
||||
|
||||
class DummyAuth(object):
|
||||
class DummyAuth(auth_plugin.BaseAuthPlugin):
|
||||
"""A dummy Auth object
|
||||
|
||||
It is needed for _KeystoneAdapter to get the user_id from, but otherwise
|
||||
@ -174,6 +175,9 @@ class DummyAuth(object):
|
||||
def __bool__(self):
|
||||
return False
|
||||
|
||||
def get_headers(self, session, **kwargs):
|
||||
return {}
|
||||
|
||||
|
||||
class Password(forms.Form):
|
||||
"""Form used for changing user's password without having to log in."""
|
||||
@ -233,7 +237,9 @@ class Password(forms.Form):
|
||||
client.users.client.endpoint_override = region
|
||||
try:
|
||||
client.users.update_password(original_password, password)
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
LOG.error("Unable to update password due to exception: %s",
|
||||
e)
|
||||
raise forms.ValidationError(
|
||||
_("Unable to update the user password."))
|
||||
return self.cleaned_data
|
||||
|
Loading…
Reference in New Issue
Block a user