From bdb3f9d988afa23619af4d8c013ffa062347aa5f Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Fri, 12 Oct 2018 12:20:12 +0200 Subject: [PATCH] Fix changing user's own password The original code is monkey-patching keystoneclient object to add a user_id attribute to it. This no longer works with more recent versions of keystoneclient, as they wrap the client in a helper class. I'm not happy with this solution, it's likely to have side effects and to break again. I'm putting it up for discussion for a better solution. Change-Id: Idb296d1b10fa02a0b4852e96fe8cb2bdd70380e0 Closes-bug: #1776678 --- openstack_dashboard/api/keystone.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index 7ae5bbe273..145be94954 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -566,10 +566,11 @@ def user_verify_admin_password(request, admin_password): @profiler.trace def user_update_own_password(request, origpassword, password): client = keystoneclient(request, admin=False) - client.user_id = request.user.id if VERSIONS.active < 3: + client.user_id = request.user.id return client.users.update_own_password(origpassword, password) else: + client.users.client.session.auth.user_id = request.user.id return client.users.update_password(origpassword, password)