Skip to content

Commit

Permalink
fix(passport): Find customer by email case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed May 17, 2024
1 parent 1798d8d commit 23ad6a8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/passport/src/firebase/authenticate-customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import api from '@cloudcommerce/api';
import getEnv from '@cloudcommerce/firebase/lib/env';

export const findCustomerByEmail = async (email: string, docNumber?: string) => {
const params: Partial<Record<keyof Customers, string>> = {
main_email: email,
const params: Partial<Record<keyof Customers | `${keyof Customers}~`, string>> = {
'main_email~': email,
};
if (docNumber) {
params.doc_number = docNumber;
Expand All @@ -16,6 +16,7 @@ export const findCustomerByEmail = async (email: string, docNumber?: string) =>
params,
fields: [
'_id',
'main_email',
'login',
'enabled',
'display_name',
Expand Down
1 change: 0 additions & 1 deletion packages/passport/src/firebase/serve-passport-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default async (req: Request, res: Response) => {
const customerId = customerMatch._id;
const customer = {
...customerMatch,
main_email: email,
doc_number: docNumber,
};
const level = docNumber ? 1 : 0;
Expand Down

0 comments on commit 23ad6a8

Please sign in to comment.