From 1f86eafc8adad821e98b33a78947244d6f13cb65 Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Sun, 29 Dec 2024 22:48:54 +0300 Subject: [PATCH] update conflict resolution, in the right place --- blogin.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blogin.sh b/blogin.sh index 0bc815d..9b512b8 100644 --- a/blogin.sh +++ b/blogin.sh @@ -60,13 +60,13 @@ case "$action" in exit 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") if [[ "$row" == "null" ]]; then hash=$(printf '%s' "$password" | argon2_hash) echo "registering user $username" >&2 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 else