Skip to content

Lowered email when creating new customer and login - #85

Open
FerdiHS wants to merge 1 commit into
mainfrom
fix/normalize-email
Open

Lowered email when creating new customer and login#85
FerdiHS wants to merge 1 commit into
mainfrom
fix/normalize-email

Conversation

@FerdiHS

@FerdiHS FerdiHS commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

This pull request introduces improvements to the customer creation API and the customer lookup logic, focusing on better input validation and more robust email handling.

Input validation:

  • Added a check to ensure the email field is a string in the POST handler of app/api/createCustomer/route.tsx, returning a clear error if not.

Email normalization and lookup:

  • Updated the getCustomerByEmail function in lib/db.ts to normalize the email by trimming whitespace and converting to lowercase before querying. If no match is found and the normalized email differs from the original, a second query is performed using the original email value. This improves reliability for customer lookups regardless of input formatting.

Related Issues:

@FerdiHS
FerdiHS requested a review from izruff September 22, 2025 10:23
@FerdiHS FerdiHS self-assigned this Sep 22, 2025
@FerdiHS FerdiHS added the bug Something isn't working label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Email login should be case-insensitive

1 participant