19 lines
574 B
Bash
19 lines
574 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Set the username and password
|
||
|
USERNAME="boxuser"
|
||
|
PASSWORD="boxuser"
|
||
|
EMAIL="boxuser@r8z.us"
|
||
|
|
||
|
# Set the database file and table name
|
||
|
DB_FILE="../boxes-api/data/boxes.db"
|
||
|
TABLE_NAME="users"
|
||
|
|
||
|
# Generate the bcrypt encrypted password using htpasswd
|
||
|
ENCRYPTED_PASSWORD=$(htpasswd -bnBC 10 "" "$PASSWORD" | tr -d ':\n')
|
||
|
|
||
|
# Insert the username and encrypted password into the database
|
||
|
sqlite3 "$DB_FILE" "INSERT INTO $TABLE_NAME (username, password, email) VALUES ('$USERNAME', '$ENCRYPTED_PASSWORD', '$EMAIL')"
|
||
|
|
||
|
echo "Password encrypted and stored in the database."
|