T.: Improved string escapes in our scripts

This commit is contained in:
artemislena 2023-12-16 17:42:15 +01:00
parent 676a6800f7
commit 4adc95224b
No known key found for this signature in database
GPG key ID: 412A96FD1D74214B
2 changed files with 2 additions and 2 deletions

View file

@ -12,7 +12,7 @@ systemctl start podman-invidious_register
CONTINUE='y'
while [ "$CONTINUE" = 'y' ]; do
read -rp 'User ID: ' ID
if [ "$(su postgres -c "psql invidious -c \"SELECT email FROM users WHERE email = '$ID';\"" | tail -n 2 | head -n 1)" != '(0 rows)' ]; then
if [ "$(su postgres -c "psql invidious -c \"SELECT email FROM users WHERE email = '\"'$ID'\"';\"" | tail -n 2 | head -n 1)" != '(0 rows)' ]; then
echo 'Error: User ID is already taken'
continue
fi

View file

@ -38,5 +38,5 @@ if [ "$(su postgres -c "psql invidious -c \"SELECT email FROM users WHERE email
fi
HASH="$(mkpasswd --method=bcrypt-a -R 10)"
su postgres -c "psql invidious -c \"UPDATE users SET password = '$HASH' WHERE email = '$ID';\""
su postgres -c "psql invidious -c \"UPDATE users SET password = '\"'$HASH'\"' WHERE email = '\"'$ID'\"';\""
```