Conversation
Adding an API user, or changing one's e-mail, to an address another API user has broke the unique e-mail index and answered 500. Both validators now say the address is taken. The service stores the e-mail in lower case, as GetUserByEmail looks it up: a mixed-case address slipped past the check and could not sign in either.
…-taken # Conflicts: # src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml # src/Web/Grand.Web/App_Data/Resources/Upgrade/en_250.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
Admin → System → API users: adding a user with the e-mail of an existing API user, or changing a user's e-mail to one, answered 500. The
UserApi.Emailindex is unique and the validators only checked that a customer with that e-mail exists. The e-mail was also stored as typed, whileGetUserByEmail(used by the token endpoint and the JWT check) compares with a lower-case address, so an API user created with capitals could not get a token.Solution
UserApiCreateValidatorandUserApiValidatorrefuse an e-mail that another API user has ("An API user with this e-mail already exists"); editing a user keeps its own e-mail.UserApiServicestores the e-mail in lower case on insert and update, asGetUserByEmaillooks it up, so the check and the index agree.New resource
Admin.System.UserApi.Email.Registered, inDefaultLanguage.xmlandUpgrade/en_250.xml.Breaking changes
None. Existing records keep the e-mail they have until they are saved again; a mixed-case record that already exists can still collide with the same address typed identically.
Testing
Api@Shop.com: stored asapi@shop.com, andPOST /api/token/createwith that e-mail returns a token.Tests:
UserApiValidatorTests,UserApiServiceTests(lower case on insert and update).