Add: add_user script
Run `add_user.sh` in the extra/ directory to manually add an admin user.
This commit is contained in:
parent
6e28c771f3
commit
07c870fb71
16
extra/add_user.sh
Normal file
16
extra/add_user.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
read -p "Username: " username
|
||||||
|
read -sp "Password: " password
|
||||||
|
echo
|
||||||
|
|
||||||
|
hash=$(python3 -c "
|
||||||
|
from werkzeug.security import generate_password_hash;
|
||||||
|
print(generate_password_hash('$password'))
|
||||||
|
")
|
||||||
|
|
||||||
|
mysql -uassetadmin -p1234 asset_test_db <<EOF
|
||||||
|
INSERT INTO users (username, password_hash)
|
||||||
|
VALUES ('$username', '$hash');
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "User $username added successfully"
|
Loading…
Reference in New Issue
Block a user