Fix path and add loggin

This commit is contained in:
decentral1se 2021-06-18 09:07:22 +02:00
parent ab248fb9c3
commit 7c710d2236
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A

View File

@ -36,7 +36,7 @@ if not exists(Path("accounts.txt").absolute()):
print("Missing accounts.txt!")
exit(1)
with open("emails.txt") as handle:
with open("accounts.txt") as handle:
emails = handle.readlines()
keycloak = init_keycloak()
@ -58,10 +58,13 @@ for email in emails:
try:
user_id = keycloak.create_user(payload, exist_ok=False)
print(f"Account created for {email}")
keycloak.send_update_account(
user_id=user_id, payload=json.dumps(["UPDATE_PASSWORD", "UPDATE_PROFILE"])
)
print(f"UPDATE_PASSWORD/PROFILE actions set for {email}")
keycloak.send_verify_email(user_id=user_id)
print(f"Verification mail sent to {email}")
except Exception as exception:
print(f"Keycloak user registration failed, saw: {exception}")
if not confirm():