Fix path and add loggin
This commit is contained in:
parent
ab248fb9c3
commit
7c710d2236
@ -36,7 +36,7 @@ if not exists(Path("accounts.txt").absolute()):
|
|||||||
print("Missing accounts.txt!")
|
print("Missing accounts.txt!")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
with open("emails.txt") as handle:
|
with open("accounts.txt") as handle:
|
||||||
emails = handle.readlines()
|
emails = handle.readlines()
|
||||||
|
|
||||||
keycloak = init_keycloak()
|
keycloak = init_keycloak()
|
||||||
@ -58,10 +58,13 @@ for email in emails:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
user_id = keycloak.create_user(payload, exist_ok=False)
|
user_id = keycloak.create_user(payload, exist_ok=False)
|
||||||
|
print(f"Account created for {email}")
|
||||||
keycloak.send_update_account(
|
keycloak.send_update_account(
|
||||||
user_id=user_id, payload=json.dumps(["UPDATE_PASSWORD", "UPDATE_PROFILE"])
|
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)
|
keycloak.send_verify_email(user_id=user_id)
|
||||||
|
print(f"Verification mail sent to {email}")
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
print(f"Keycloak user registration failed, saw: {exception}")
|
print(f"Keycloak user registration failed, saw: {exception}")
|
||||||
if not confirm():
|
if not confirm():
|
||||||
|
Loading…
Reference in New Issue
Block a user