W
Wasp4d ago
cooluke.

Getting invalid email error even with a valid email, when uppercase letters are in the domain name

Using the builtin email auth with SendGrid, I have a user who discovered a bug. They put in their email address like this:
And they received this error from Wasp:
Validation failed: email must be a valid email
Validation failed: email must be a valid email
(wasp outright rejected it and never passed the email to SendGrid) This is frustrating because it IS a valid email. HOWEVER, if they make the domain name all lowercase, it works!
What can I do in this scenario? I don't see ways to edit the validation for the builtin email auth.
4 Replies
kapa.ai
kapa.ai4d ago
Hi @cooluke.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Thank you for your question about Wasp's email authentication. This is indeed an interesting issue you've encountered with the email validation. Based on the information provided in the knowledge sources, Wasp's default email validation for the email authentication method is case-insensitive. According to the Auth Overview documentation:
Note that emails are stored in a case-insensitive manner.
However, it seems that the validation is not working as expected in your case, particularly with uppercase letters in the domain name. Unfortunately, the knowledge sources don't provide a direct solution to this specific problem. The default validations are built into Wasp's authentication system, and there isn't a straightforward way to modify them when using the built-in email auth. That being said, there are a couple of potential approaches you could consider: 1. Custom Sign-up Action: You could create a custom sign-up action where you can implement your own email validation. This is mentioned in the Email Authentication documentation. However, this would require more work on your part to implement the entire sign-up process. 2. Wait for Auth Overhaul: As mentioned by a Wasp team member in a Discord conversation, there's an upcoming auth overhaul in Wasp version 0.12, which is expected to be released in a few weeks. This update might address the case sensitivity issue you're experiencing. Discord support thread:
We however do recommend using email/pass for production use, as username/pass is very basic. Also, we will be releasing new version of Wasp in a couple of weeks, 0.12, and it will have big Auth overhaul.
For now, as a temporary workaround, you might want to inform your users to use lowercase email addresses, especially in the domain part. If this issue is critical for your application, I recommend reaching out to the Wasp team directly through their Discord channel or via email at [email protected] as mentioned in their Contact page. They might be able to provide more specific guidance or a temporary fix until the auth overhaul is released. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @cooluke., I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
miho
miho4d ago
You are right, the regex we used internally is too strict, this is another issue we saw before: https://github.com/wasp-lang/wasp/issues/1392 This is what I would consider "customisation of the validation for the auth" covered under this issue: https://github.com/wasp-lang/wasp/issues/1571 We want to expose a way for you to: - customise the password validation - customise the email/username validation What you can do now? Nothing really, until we implement the customisation. You can however implement custom signup logic: https://wasp.sh/docs/auth/email#creating-a-custom-sign-up-action
GitHub
Alter email validation regex to accept UTF-8 emails · Issue #1392 ·...
Wasp's email validator doesn't allow emails with umlauts (report: https://discord.com/channels/686873244791210014/812664118887841813/1139192497495621784) Solution We are using a pretty spec...
GitHub
Enable auth validation customisation · Issue #1571 · wasp-lang/wasp
We should add an API in the Wasp file for providing custom auth field validations. It should be front and centar and easy as e.g. Signup Field Customisation
Email | Wasp
Wasp supports e-mail authentication out of the box, along with email verification and "forgot your password?" flows. It provides you with the server-side implementation and email templates for all of these flows.
cooluke.
cooluke.OP3d ago
thank you!
MEE6
MEE63d ago
Wohooo @cooluke., you just became a Waspeteer level 2!

Did you find this page helpful?