moved config to a json, which makes adding more variables easier, but perhaps otherwise adds complexity
This commit is contained in:
28
forum/change_admin_pw.sh
Normal file
28
forum/change_admin_pw.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SQLITE=sqlite3
|
||||
PYTHON=python3
|
||||
|
||||
set -eu
|
||||
|
||||
if [[ -z "$DB" ]]; then
|
||||
echo set DB env to the Sqlite database.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p 'Admin username: ' username
|
||||
read -sp 'Admin password: ' password
|
||||
|
||||
|
||||
password=$($PYTHON tool.py password "$password")
|
||||
time=$($PYTHON -c 'import time; print(time.time_ns())')
|
||||
|
||||
$SQLITE "$DB" "
|
||||
UPDATE users
|
||||
SET password = '$password',
|
||||
role = 2,
|
||||
join_time = $time
|
||||
WHERE
|
||||
user = lower('$username')
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user