Return only exact matches from InternalAccountQuery#byPreferredEmail
Doing an account query on the preferredemail field finds accounts with a preferred email that matches the given email case insensitive or that starts with that prefix (also case insensitive). However all callers are only interested in exact matches. Instead of letting each caller filter out non-exact matches do this filtering once in InternalAccountQuery#byPreferredEmail. Change-Id: If893d1bd8857fd69b3c2222ba104aa9ee212f936 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -223,8 +223,6 @@ class BecomeAnyAccountLoginServlet extends HttpServlet {
|
||||
.get()
|
||||
.byPreferredEmail(email)
|
||||
.stream()
|
||||
// the index query also matches prefixes, filter those out
|
||||
.filter(a -> email.equalsIgnoreCase(a.getAccount().getPreferredEmail()))
|
||||
.map(AccountState::getAccount)
|
||||
.findFirst();
|
||||
return match.isPresent() ? auth(match.get()) : null;
|
||||
|
||||
Reference in New Issue
Block a user