-
Notifications
You must be signed in to change notification settings - Fork 169
A business logic bug within auth.scala #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @patseev , thanks for the report! Looking at it now I would definitely model that function to perform a lookup just by |
Oh @patseev, I think that is expected! The lookup is performed via
I'm afraid I don't understand this, what do you mean? A conflict can only happen if the same |
Oh I get it now (sorry, Sunday after a few beers 😄 ) So yeah that's the validation for creating a new user you're talking about, definitely a case that wasn't tested. I'll get it fixed soon! |
Hey! Found a business logic bug within Auth algebra.
https://github.com/gvolpe/pfps-shopping-cart/blob/second-edition/modules/core/src/main/scala/shop/algebras/auth.scala#L68
Basically,
users.find
will returnSome(User)
only in case if caller has provided correct username & password. I suppose you need to introduce a different method that performs a search only viausername
.Otherwise, given a username conflict it will go to
None
branch, then will attempt inserting a user with conflicting username and will raise a postgres-level exception instead of your custom one.The text was updated successfully, but these errors were encountered: