Files
sqlpage--sqlpage/examples/user-authentication/create_user.sql
Guillaume DELVIT 6757addfb6 Remove obsolete comment.
ON CONFLICT (xxx) DO NOTHING is natively supported by sqlite.

https://sqlite.org/lang_upsert.html
2024-05-22 20:38:21 +02:00

11 lines
457 B
SQL

INSERT INTO user_info (username, password_hash)
VALUES (:username, sqlpage.hash_password(:password))
ON CONFLICT (username) DO NOTHING
RETURNING
'redirect' AS component,
'create_user_welcome_message.sql?username=' || :username AS link;
-- If we are still here, it means that the user was not created
-- because the username was already taken.
SELECT 'redirect' AS component, 'create_user_welcome_message.sql?error&username=' || :username AS link;