create new password (principal) if does not exist
parent
756f6cbe66
commit
9ad4122061
|
@ -88,15 +88,20 @@ def main():
|
|||
if args.show_password:
|
||||
print(f'password: "{password}"')
|
||||
|
||||
action = 'reset' if p is not None else 'create'
|
||||
i = input(
|
||||
f"Type yes to reset {user}'s password and send email to {address}\n"
|
||||
f"Type yes to {action} {user}'s password and send email to {address!r}\n"
|
||||
).strip()
|
||||
if i != "yes":
|
||||
print("Aborted")
|
||||
return
|
||||
|
||||
p.change_password(password)
|
||||
print("password changed")
|
||||
if p is None:
|
||||
k.add_principal(user, password)
|
||||
print("password created")
|
||||
else:
|
||||
p.change_password(password)
|
||||
print("password changed")
|
||||
|
||||
send_mail(args.admin, admin_pass, password, user, address)
|
||||
print("email sent")
|
||||
|
|
Loading…
Reference in New Issue