OpenSlides/docker/reset-admin-password.sh

17 lines
740 B
Bash
Raw Normal View History

2020-10-05 10:43:43 +02:00
#!/bin/bash
# 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
# 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"