parent
dfd0c89007
commit
9679a1f2a4
@ -0,0 +1,36 @@ |
||||
#!/bin/bash |
||||
|
||||
die() { echo >&2 "$@" ; exit 1 ; } |
||||
PATH=$PATH:/opt/keycloak/bin |
||||
|
||||
USERNAME="$1" |
||||
|
||||
if [ -z "$USERNAME" ]; then |
||||
die "usage: $0 username email" |
||||
fi |
||||
|
||||
ID="$(kcadm.sh get users \ |
||||
-r "$REALM" \ |
||||
--fields id \ |
||||
-q username="$USERNAME" \ |
||||
--format csv \ |
||||
--noquotes \ |
||||
)" |
||||
|
||||
if [ -z "$ID" ]; then |
||||
die "$USERNAME: unable to fetch UID" |
||||
fi |
||||
|
||||
echo "$USERNAME: $ID" |
||||
|
||||
echo -n '["UPDATE_PASSWORD"]' | \ |
||||
kcadm.sh update \ |
||||
"users/$ID/execute-actions-email" \ |
||||
-r $REALM \ |
||||
-q client_id=hedgedoc \ |
||||
-q redirect_uri="https://${HEDGEDOC_HOSTNAME}.${DOMAIN_NAME}/s/Getting_started" \ |
||||
-f - \ |
||||
|| die "$USERNAME: unable to send email?" |
||||
|
||||
echo "$USERNAME: email sent!" |
||||
|
Loading…
Reference in new issue