2020-10-05 10:43:43 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-08-30 17:11:15 +02:00
|
|
|
# This script sets password of user 1 (superadmin) to superadmin. You may also use the manage tool for this work.
|
|
|
|
|
2020-10-05 10:43:43 +02:00
|
|
|
set -e
|
|
|
|
|
2021-08-30 17:11:15 +02:00
|
|
|
# Hash the new password
|
|
|
|
response=$(docker-compose exec auth curl --header "Content-Type: application/json" -d '{"toHash": "superadmin"}' http://localhost:9004/internal/auth/hash)
|
2020-10-05 10:43:43 +02:00
|
|
|
hash=$(jq .hash <<< $response)
|
|
|
|
|
|
|
|
# Set user/1/password to $hash
|
|
|
|
request_data_prefix='{"user_id": 1, "information": {}, "locked_fields": {}, "events": [{"type": "update", "fqid": "user/1", "fields": {"password":'
|
|
|
|
request_data="$request_data_prefix $hash}}]}"
|
|
|
|
docker-compose exec backend curl --header "Content-Type: application/json" -d "$request_data" http://datastore-writer:9011/internal/datastore/writer/write
|
|
|
|
|
|
|
|
echo "Done"
|