mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Update requirement checking for password reset
This commit is contained in:
parent
a6148a7d8a
commit
ceab737667
@ -74,20 +74,23 @@ class MainPrompt(cmd.Cmd):
|
||||
except:
|
||||
Console.error(f"User: {line} Not Found")
|
||||
return False
|
||||
# get new password from user
|
||||
new_pass = getpass.getpass(prompt=f"NEW password for: {username} > ")
|
||||
# check to make sure it fits our requirements.
|
||||
if len(new_pass) > 512:
|
||||
Console.warning("Passwords must be greater than 6char long and under 512")
|
||||
return False
|
||||
if len(new_pass) < 6:
|
||||
Console.warning("Passwords must be greater than 6char long and under 512")
|
||||
return False
|
||||
# grab repeated password input
|
||||
new_pass_conf = getpass.getpass(prompt="Re-enter your password: > ")
|
||||
|
||||
# check to make sure they match
|
||||
if new_pass != new_pass_conf:
|
||||
Console.error("Passwords do not match. Please try again.")
|
||||
return False
|
||||
|
||||
if len(new_pass) > 512:
|
||||
Console.warning("Passwords must be greater than 6char long and under 512")
|
||||
return False
|
||||
|
||||
if len(new_pass) < 6:
|
||||
Console.warning("Passwords must be greater than 6char long and under 512")
|
||||
return False
|
||||
self.controller.users.update_user(user_id, {"password": new_pass})
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
Reference in New Issue
Block a user