Compare commits
2 Commits
ab248fb9c3
...
f99d069d61
Author | SHA1 | Date |
---|---|---|
decentral1se | f99d069d61 | |
decentral1se | 7c710d2236 |
|
@ -36,8 +36,10 @@ 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 = [email.strip() for email in handle.readlines()]
|
||||||
|
|
||||||
|
print(f"Parsed {emails} from accounts.txt")
|
||||||
|
|
||||||
keycloak = init_keycloak()
|
keycloak = init_keycloak()
|
||||||
|
|
||||||
|
@ -58,10 +60,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