upstream/openstack/python-keystoneclient/python-keystoneclient/v2-client-empty-password-ch...

27 lines
1.1 KiB
Diff

---
keystoneclient/v2_0/shell.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/keystoneclient/v2_0/shell.py
+++ b/keystoneclient/v2_0/shell.py
@@ -141,7 +141,8 @@ def do_user_password_update(kc, args):
"""Update user password."""
user = utils.find_resource(kc.users, args.user)
new_passwd = args.passwd or utils.prompt_for_password()
- if new_passwd is None:
+ # if password is empty or blank then reject it
+ if new_passwd is None or new_passwd.strip() is "":
msg = (_("\nPlease specify password using the --pass option "
"or using the prompt"))
sys.exit(msg)
@@ -167,7 +168,8 @@ def do_password_update(kc, args):
currentpasswd = getpass.getpass(_('Current Password: '))
newpasswd = args.newpasswd
- while newpasswd is None:
+ # don't allow empty or blank passwords
+ while newpasswd is None or newpasswd.strip() is "":
passwd1 = getpass.getpass(_('New Password: '))
passwd2 = getpass.getpass(_('Repeat New Password: '))
if passwd1 == passwd2: