lib/vmc/cli/user/passwd.rb in vmc-0.5.0.beta.5 vs lib/vmc/cli/user/passwd.rb in vmc-0.5.0.beta.6
- old
+ new
@@ -21,18 +21,27 @@
password = input[:password] if v2?
new_password = input[:new_password]
verify = input[:verify]
if new_password != verify
- fail "Passwords don't match."
+ fail "Passwords do not match."
end
- with_progress("Changing password") do
- if v2?
- user.change_password!(new_password, password)
- else
- user.password = new_password
- user.update!
+ pw_strength = client.base.uaa.password_score(new_password)
+ msg = "Your password strength is: #{pw_strength}"
+
+ if pw_strength == :weak
+ fail msg
+ else
+ line msg
+
+ with_progress("Changing password") do
+ if v2?
+ user.change_password!(new_password, password)
+ else
+ user.password = new_password
+ user.update!
+ end
end
end
end
private