"DEFINE SCOPE statement" Improvement #2106
dormammun
started this conversation in
Documentation
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Suggest to improve these docs.
This statement will not work on
signin
because user cansingup
with duplicated email. Andselect
statement will return two users.Because
SELECT * FROM user WHERE email = $email AND crypto::argon2::compare(pass, $pass)
returns an array of two users.Suggestions:
Add limit.
SIGNIN ( SELECT * FROM user WHERE email = $email AND crypto::argon2::compare(pass, $pass) ) LIMIT 1
But this is bad logic for authentication.
Return meaningful error because without debugging it is hard to understand what's wrong.
Original error:
user
table configuration.Thank you for great database 👍
I'm really looking forward to your release v1. And I beg you to add different business cases/examples/scenarios for documentation. :)
Question:
When I create
article
in the last scenario withdb.create
don't create a record and don't emit error.I can guess that in the first request I need somehow get a user ID and pass it to the object. But when I
signin
I get only a token without the ability to retrieve the user by the token. So, I require 1-st: authenticate user, and 2-nd: fetch him again by credentials to get ID. Is there a workaround?Beta Was this translation helpful? Give feedback.
All reactions