update conflict resolution, in the right place
This commit is contained in:
parent
659ef11451
commit
1f86eafc8a
1 changed files with 2 additions and 2 deletions
|
@ -60,13 +60,13 @@ case "$action" in
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
{
|
{
|
||||||
query="SELECT password FROM users WHERE username=$(escape_sql_str "$username") ON CONFLICT (username) DO SET password=excluded.password"
|
query="SELECT password FROM users WHERE username=$(escape_sql_str "$username")"
|
||||||
row=$(db_row "$query")
|
row=$(db_row "$query")
|
||||||
if [[ "$row" == "null" ]]; then
|
if [[ "$row" == "null" ]]; then
|
||||||
hash=$(printf '%s' "$password" | argon2_hash)
|
hash=$(printf '%s' "$password" | argon2_hash)
|
||||||
echo "registering user $username" >&2
|
echo "registering user $username" >&2
|
||||||
unset password
|
unset password
|
||||||
db_query "INSERT INTO users (username, password) VALUES ($(escape_sql_str "$username"), $(escape_sql_str "$hash"))" >&2
|
db_query "INSERT INTO users (username, password) VALUES ($(escape_sql_str "$username"), $(escape_sql_str "$hash")) ON CONFLICT (username) DO SET password=excluded.password" >&2
|
||||||
|
|
||||||
created=true
|
created=true
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue