From 1229bd4bb43882d681937ad799a3a2c8a37193e6 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Tue, 5 Nov 2019 12:20:28 +0800 Subject: [PATCH] Fix change expired password feature Closes-Bug: #1791111 Change-Id: I5f2a027149be490613e7661b895325a63374334d (cherry picked from commit c0cc0433c645181a9031b99d23954ae9bece9542) --- openstack_auth/forms.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openstack_auth/forms.py b/openstack_auth/forms.py index 49470c8620..ba9cccfe6a 100644 --- a/openstack_auth/forms.py +++ b/openstack_auth/forms.py @@ -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