restructure: flatten scripts dirs, remove roster, update SKILL.md
This commit is contained in:
31
keycloak-hangman-lab/scripts/verify-email
Executable file
31
keycloak-hangman-lab/scripts/verify-email
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory where this script is located
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
# Get username from secret-mgr
|
||||
username=$(secret-mgr get-username --key keycloak)
|
||||
|
||||
if [[ -z "$username" ]]; then
|
||||
echo "Error: No keycloak username found in secret-mgr"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
realm="Hangman-Lab"
|
||||
|
||||
# Check if user exists
|
||||
result=$("$SCRIPT_DIR/kcadm" get users -r "$realm" -q "username=$username")
|
||||
user_count=$(echo "$result" | jq 'length')
|
||||
|
||||
if [[ "$user_count" -eq 0 ]]; then
|
||||
echo "Error: User $username not found in Keycloak"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get user ID
|
||||
userid=$(echo "$result" | jq -r '.[0].id')
|
||||
|
||||
# Set email verified
|
||||
"$SCRIPT_DIR/kcadm" update users/"$userid" -r "$realm" -s "emailVerified=true"
|
||||
|
||||
echo "Email verified for user: $username"
|
||||
Reference in New Issue
Block a user