Skip to content

Accept internationalized emails. Fix uppercase and anchor bugs in email auth. - #4695

Open
FranjoMindek wants to merge 22 commits into
mainfrom
fix/email-validation-unicode-and-anchoring
Open

Accept internationalized emails. Fix uppercase and anchor bugs in email auth.#4695
FranjoMindek wants to merge 22 commits into
mainfrom
fix/email-validation-unicode-and-anchoring

Conversation

@FranjoMindek

@FranjoMindek FranjoMindek commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #1392.
Started as "Accept internationalized emails" PR, but fixes some bugs along the way.

Description

Input Was accepted Should be accepted
user@example.com
plainaddress
user@münchen.de
jürgen@example.com ✅ (by accident, see problem 2)
FRANJO@gmail.com
franjo@Gmail.com
a@b.com <script>alert(1)</script>
I am not an email, ask a@b.com
<65 chars>@example.com

Four problems:

  1. No Unicode support. E.g. user@münchen.de is rejected.

  2. The regex was never anchored. input.match(validEmailRegex) with no ^/$, so any string containing something address-shaped passed. This is also why jürgen@example.com appeared to work: the substring rgen@example.com matched. Anchoring the old regex and re-running rejects it, confirming the pass was accidental.

  3. The regex was lowercase-only. Every character class was [a-z0-9...]. Validation runs on req.body at signup.ts:47, while lowercasing only happens in createProviderId at signup.ts:49, so the validator sees whatever casing the user typed.

    Defect 2 partly masks this one, which is why it is easy to miss: since the regex is unanchored, an address is accepted as long as some substring of it matches. In practice an address passes only if its domain is entirely lowercase and the run of characters immediately before the @ is lowercase. Measured against main:

    Input main accepts Substring it matched
    FRANJO.mindek@gmail.com mindek@gmail.com
    FRANJO.Mindek@gmail.com indek@gmail.com
    FRANJO@gmail.com
    FRANJO.M@gmail.com
    franjo@Gmail.com
    franjo@gmail.COM
  4. No length limits. A local part of any length was accepted.

What this PR does

isValidEmail is moved into @wasp.sh/lib-auth, so the client form and the server run the same check.

The new grammar is the HTML5 input[type=email] grammar widened to accept Unicode letters, marks and digits, plus the RFC 5321 size limits. It is anchored and case-insensitive.

The auth form drops type="email" in favour of type="text" + inputMode="email", and validates via react-hook-form with the same isValidEmail. This is because type="email" forces HTML5 validation, which does not allow unicode. By using correct inputMode we still keep the sam UX for mobile users (email keyboard) while providing better email support.

Why this shape

  • Match the HTML5 grammar rather than RFC 5322. WHATWG calls its own grammar a deliberate "willful violation" of RFC 5322, on the grounds that it is simpler and more useful. Implementing RFC 5322 properly is hard, and has features we don't care about. HTML5's emails are are good compromise between following rules and complexity.
  • Widen it for Unicode, on by default. Internationalized addresses are standard (RFC 6531 SMTPUTF8, RFC 6532).
    Rejecting one locks a user out of the app entirely, whereas accepting an undeliverable one just means no verification email arrives.
  • Size limits from RFC 5321 §4.5.3.1, counted in octets since that is how the RFC counts them.

Type of change

  • 🔧 Just code/docs improvement
  • 🐞 Bug fix
  • 🚀 New/improved feature
  • 💥 Breaking change

Checklist

  • I tested my change in a Wasp app to verify that it works as intended.

    Built examples/kitchen-sink (email auth) and a scratch app with username-only auth, to check both branches of the new conditional codegen compile. Ran the kitchen-sink Playwright suite in build mode (44/44 passing), which exercises signup with jürgen-<uuid>@münchen.test end to end: form submit → server validation → verification email delivered through SMTP to Mailcrab → verification link → login.

  • 🧪 Tests and apps:

    • I added unit tests for my change.

    • (if you fixed a bug) I added a regression test for the bug I fixed.

      waspc/data/Generator/libs/auth/tests/email.test.ts, 45 tests, with one group per defect: internationalized addresses, case, anchoring, size limits. The case group covers uppercase confined to the domain and uppercase confined to the local part separately, since defect 3 manifests differently in each.

    • (if you added/updated a feature) I added/updated e2e tests in examples/kitchen-sink/e2e-tests.

    • (if you added/updated a feature) I updated the starter templates in waspc/data/Cli/templates, as needed.

    • (if you added/updated a feature) I updated the example apps in examples/, as needed.

      • (if you updated examples/tutorials) I updated the tutorial in the docs (and vice versa).
  • 📜 Documentation:

    • (if you added/updated a feature) I added/updated the documentation in web/docs/.

      The docs don't describe the email validation rules, so there was nothing to update.

  • 🆕 Changelog: (if change is more than just code/docs improvement)

    • I updated waspc/ChangeLog.md with a user-friendly description of the change.

    • (if you did a breaking change) I added a step to the current migration guide in web/docs/migration-guides/.

    • I bumped the version in waspc/waspc.cabal to reflect the changes I introduced.

      Already at 0.26.0, which is unreleased.

@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wasp.sh/spec

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/spec@4695

@wasp.sh/wasp-cli

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli@4695

@wasp.sh/wasp-cli-darwin-arm64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-arm64-unknown@4695

@wasp.sh/wasp-cli-darwin-x64-unknown

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-darwin-x64-unknown@4695

@wasp.sh/wasp-cli-linux-arm64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-arm64-glibc@4695

@wasp.sh/wasp-cli-linux-x64-glibc

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-glibc@4695

@wasp.sh/wasp-cli-linux-x64-musl

npx https://pkg.pr.new/wasp-lang/wasp/@wasp.sh/wasp-cli-linux-x64-musl@4695

commit: a57d428

@FranjoMindek
FranjoMindek marked this pull request as ready for review August 12, 2026 13:09
@FranjoMindek
FranjoMindek requested a review from a team as a code owner August 12, 2026 13:09
@FranjoMindek
FranjoMindek requested review from infomiho and removed request for a team August 12, 2026 13:09

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

The new Unicode acceptance can route password-reset tokens to a different mailbox after provider-ID lowercasing; this must be fixed before merge.

Reviewed changes Reviewed the shared email validator, generated client and server integration, auth-flow regression tests, and regenerated golden outputs.

  • Shared validation — Moves email syntax validation into the isomorphic auth library, adds Unicode and uppercase support, anchors the grammar, and enforces octet limits.
  • Generated auth forms — Reuses the shared validator in login, signup, and forgot-password forms while replacing the browser's ASCII-only type="email" validation.
  • Regression coverage — Adds validator unit cases and kitchen-sink signup, verification, login, and malformed-input e2e scenarios.
  • Generated outputs — Updates conditional auth code generation, snapshots, checksums, and the changelog.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using GPT Sol𝕏

Comment thread waspc/data/Generator/libs/auth/src/email.ts Outdated
Comment thread waspc/data/Generator/libs/auth/src/email.ts Outdated
@FranjoMindek
FranjoMindek marked this pull request as draft August 12, 2026 13:29
@FranjoMindek
FranjoMindek temporarily deployed to railway-deploy-test August 12, 2026 13:30 — with GitHub Actions Inactive
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8fc0d8e
Status: ✅  Deploy successful!
Preview URL: https://fad4ce01.wasp-docs-on-main.pages.dev
Branch Preview URL: https://fix-email-validation-unicode.wasp-docs-on-main.pages.dev

View logs

@FranjoMindek
FranjoMindek marked this pull request as ready for review August 13, 2026 07:48
pullfrog[bot]

This comment was marked as outdated.

@FranjoMindek
FranjoMindek deployed to railway-deploy-test August 26, 2026 08:53 — with GitHub Actions Active
@FranjoMindek FranjoMindek changed the title Accept internationalized and uppercase email, anchor email in auth Accept internationalized emails. Fix uppercase and anchor bugs in email auth. Aug 26, 2026
pullfrog[bot]

This comment was marked as outdated.

@FranjoMindek
FranjoMindek deployed to railway-deploy-test August 26, 2026 20:06 — with GitHub Actions Active

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Reviewed the validator type-contract correction and generated checksum refresh since the previous Pullfrog pass.

  • Restored the boolean contract — Changed isValidEmail from an unsound input is string predicate back to boolean, preserving correct false-branch typing for invalid strings.
  • Refreshed generated package metadata — Updated the auth-package checksums in all affected golden outputs to match the declaration change.

Pullfrog  | View workflow run | Using GPT Sol𝕏

@FranjoMindek
FranjoMindek deployed to railway-deploy-test August 26, 2026 20:32 — with GitHub Actions Active
<FormItemGroup>
<FormLabel>E-mail</FormLabel>
<FormInput type="email" {...register("email")} />
<FormInput type="text" inputMode="email" {...register("email")} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type=email only supports HTML5 emails, which means no unicode.

If we use it, we can't support unicode.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited description to better clarify, there is a line about it in the docs but it was disconnected from this change.

image

@Martinsos Martinsos Aug 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should comment on thi sin the code, so it is clear why this was done! The good ol' "Don't answer the reviewer, fix it for every next person who will hvae the same questoin".

@FranjoMindek FranjoMindek Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auth ui one has the comment.

/**
 * Deliberately avoids setting `type="email"`.
 * Browsers validate email input against the HTML5 grammar, which is ASCII-only
 * and would reject internationalized addresses that the server accepts.
 * `inputMode` keeps the email keyboard on mobile.
 *
 * @see {@link https://github.com/whatwg/html/issues/4562 WHATWG international email addresses issue}
 */
export const emailInputProps = {
  type: 'text',
  inputMode: 'email',
  autoComplete: 'email',
} as const

Sadly this isn't exported so we can't re-use it.
Wasp docs do mention this quirk to users.
Didn't think we would want to also add it to custom signup in kitchen-sink.

// look at https://github.com/JoshData/python-email-validator for inspiration.

/**
* The syntax we accept is the HTML5 `input[type=email]` grammar,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads to me like a signal that we might want to follow HTML5's lead and accept only ASCII emails? We don't have to be better than HTML5 standard?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an open issue about adding unicode email support to HTML though.

Email providers support unicode, browsers are just lagging behind.

We also had users encounter this problem. So it is an real issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1392

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had same toughts as Miho, why do we have to be better than html5's standard.

Do other auth solutions allow unicode? If they do, then ok let's do it.

@@ -1,3 +1 @@
/**
* NOTE: this is a placeholder file for future code exported for both runtimes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally 😄

@infomiho

Copy link
Copy Markdown
Member

I feel like we are introducing quite a bit of complexity in our codebase for edge case emails that even the HTML5 input form rejects. That's a pretty strong signal that we are out of the 80/20 territory. I'm down with cleaning up the e-mail validation (anchoring, lowercasing etc.) and I think this is long overdue.

But I'm more in favor of going for a simpler built-in validation and working on allowing users to override our validation rules for their specific case. What do you think about that?

@FranjoMindek

Copy link
Copy Markdown
Contributor Author

I feel like we are introducing quite a bit of complexity in our codebase for edge case emails that even the HTML5 input form rejects. That's a pretty strong signal that we are out of the 80/20 territory. I'm down with cleaning up the e-mail validation (anchoring, lowercasing etc.) and I think this is long overdue.

But I'm more in favor of going for a simpler built-in validation and working on allowing users to override our validation rules for their specific case. What do you think about that?

Not supporting unicode by default is an actual issue our users encountered.
So I don't think we should skip out on it.

Supprting better auth UI and server-side validation should also come, but it shouldn't be a bandaid to bad defaults.

@FranjoMindek
FranjoMindek requested a review from infomiho August 27, 2026 07:45
@infomiho

Copy link
Copy Markdown
Member

Ok fair, if that's the direction the browsers are heading - we should too. I see that Laravel and Django support unicode e-mails in their validators, so that's another good signal. I'll review with that in mind one more time.

Even though Wasp offers premade [Auth UI](../ui.md) for your authentication flows, there are times when you might want more customization, so we also give you the option to create your own UI and call Wasp's auth actions from your own code, similar to how Auth UI does it under the hood.

:::note Handling the internationalized email input
We use `type="text"` with `inputMode=email` because it allows unicode/international characters, while `type=email` only allows ASCII / english letters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo: fix typo, first / has no spaces

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also keep unicode with capitcal U to be consistent, so Unicode?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and autocomplete="email"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so I guess if they use type=email, no big deal, they are just limiting input field more than our validator, right?

Btw you use double quotes around text but not around email.

@Martinsos

Copy link
Copy Markdown
Member

I feel like we are introducing quite a bit of complexity in our codebase for edge case emails that even the HTML5 input form rejects. That's a pretty strong signal that we are out of the 80/20 territory. I'm down with cleaning up the e-mail validation (anchoring, lowercasing etc.) and I think this is long overdue.
But I'm more in favor of going for a simpler built-in validation and working on allowing users to override our validation rules for their specific case. What do you think about that?

Not supporting unicode by default is an actual issue our users encountered. So I don't think we should skip out on it.

Supprting better auth UI and server-side validation should also come, but it shouldn't be a bandaid to bad defaults.

The fact a user reporeted an issue is not argument per se, in this case. Quesoitn is, what is normal these days? If others support it (other farmeworks / auth libraries / pages) then let's do it, otherwise we odn't have to.

@FranjoMindek

FranjoMindek commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

I feel like we are introducing quite a bit of complexity in our codebase for edge case emails that even the HTML5 input form rejects. That's a pretty strong signal that we are out of the 80/20 territory. I'm down with cleaning up the e-mail validation (anchoring, lowercasing etc.) and I think this is long overdue.
But I'm more in favor of going for a simpler built-in validation and working on allowing users to override our validation rules for their specific case. What do you think about that?

Not supporting unicode by default is an actual issue our users encountered. So I don't think we should skip out on it.
Supprting better auth UI and server-side validation should also come, but it shouldn't be a bandaid to bad defaults.

The fact a user reporeted an issue is not argument per se, in this case. Quesoitn is, what is normal these days? If others support it (other farmeworks / auth libraries / pages) then let's do it, otherwise we odn't have to.

Personally, that seems like a somewhat restricted view.

But anyways, it's a mixed bag:

Framework Shape it accepts Non-English addresses Size caps Look-alike guard Domain lookup
Browsers input[type=email] the browser rule no, English letters only none none no
.NET [EmailAddress] one @, not at either end anything passes, unchecked none none no
.NET MailAddress full spec, parsed yes, both sides none none no
Django ordinary form, or quoted domain only, via punycode 320 total, nothing per part none no
Rails the browser rule, verbatim no, English letters only none none no
Devise (ruby) @ with no spaces around it anything passes, unchecked none none no
Laravel full spec, parsed yes, both sides flagged, not enforced opt-in, mixed alphabets only opt-in
Symfony browser rule; full spec on request only in the strict mode none none no
Spring / Hibernate ordinary form, or quoted yes, but not emoji-range 64 letters before @ none no
PHP filter_var 1982 spec no, English letters only none none no
Go net/mail full spec, parsed yes, both sides none none no
Python email-validator full spec, parsed yes, both sides 64 / 254 bytes built in opt-in
validator.js close to the full spec before the @ by default 64 / 254 bytes none no
Zod its own simplified rule only in the loosest preset (@ check) only in the loosest preset (char counting) none no
Wasp (this PR) browser rule, widened yes, both sides 64 / 254 bytes built in no

I tried to keep the language simple (instead of saying RFC yada yada).
My own inspiration (as mentioned somewhere) was Python's email-validator.

Some trends I can see:

  • Most don't ship safety features (rejecting e.g. invisible or zero-width chars). I copied that from Python's email-validator.
  • It seems to me that frameworks which cared to research this, either made it as simple as possible (simple "@" check), or went towards supporting the full spec. Most do support unicode.

I was hesitant about introducing another package as client bundle.
From what I researched, most of them don't do full validation client-side.
Probably because of the before-mentioned bundle.

Weirdly, some support unicode server side but users can't use it because the client ships type="email" form field which disallows it. So you have to have custom signup/login flow.

All in all, I would either:

  • leave it as is (compromise between RFC/spec and complexity, allows client and server to be in sync)
  • depend on RFC-passing email validator server-side, but make it as simple client-side (just "@" check). That would still disable type="emaill".

@FranjoMindek
FranjoMindek requested a review from Martinsos August 28, 2026 12:46

@Martinsos Martinsos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FranjoMindek check the comments but in genreal LGTM!
I guess main questoin is: is it worth it, and should we use external library instead. I don't think answer is super clear, but since we alrady were doing validatoin ourselves, and this seems to be strictly better, I say let's go for it and we can later consider switcihng to library if we feel there is a need.

<FormItemGroup>
<FormLabel>E-mail</FormLabel>
<FormInput type="email" {...register("email")} />
<FormInput type="text" inputMode="email" {...register("email")} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha this is example app and this is "custom signup code".
I am interested, if they are doing this on their own, writing custom signup page, how likely are they to know to use type text an inputMode email (or their AI)?
Do they also have to know to do the trimming? WHy didn't we also set autocomplete field here?

@@ -0,0 +1,63 @@
// TODO: If we ever need a more quality email validator, its worth to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't sound very encouraging in an auth library :D.
Maybe say that if we ever want to tighten up the email validation fuirther, we can check this one.
But could you also provide a bit of context why would we want to? I think you know now, but later somebody is reading this and has no idea if this TODO is somethign we should do soon but didn't have time, or likely won't ever wwant to do because it is overengineering, ... .

Comment on lines +9 to +10
* the possibly dangerous format characters. What still gets through is
* handled separately later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean "what still gets through is handled separately later"? What can get through and where it handles separately later and why?

*
* @see {@link https://github.com/whatwg/html/issues/4562 WHATWG international email addresses issue}
*/
const HTML5_EMAIL_WITH_UNICODE_REGEX =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah uf damn :D. What a regex :D. Do we have a good test suite for it? I have to yet see it but I hope we do.

There is a lot of repetition for this \p{L}\p{M}\p{Nd}, maybe extract that to a a named var and reuse it so we both understand wht it is + make regex easier to read?


/**
* Characters that render as nothing, so that two addresses spelled
* differently look identical on screen.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that its characters that render as nothing, but why the remark "so that two addresses spelled differently look identical on screen" -> "so" indicates some kind of cause or something, but I don't get it. Maybe best to just drop this second part of the commend because it seems to be talking about usage of this regex and don't see why you would address that here.

Comment on lines +4 to +7
* Deliberately avoids setting `type="email"`.
* Browsers validate email input against the HTML5 grammar, which is ASCII-only
* and would reject internationalized addresses that the server accepts.
* `inputMode` keeps the email keyboard on mobile.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main thing I dind't like is that your first sentence and the rest are somewhat disconnected. The fact that type="email" is the one that says use HTML5 grammar, you never say that. and I personally dind't know taht before this PR. Plus it is just hard to read even when you know about it.

Suggested change
* Deliberately avoids setting `type="email"`.
* Browsers validate email input against the HTML5 grammar, which is ASCII-only
* and would reject internationalized addresses that the server accepts.
* `inputMode` keeps the email keyboard on mobile.
* We deliberately don't use the usual `type="email"` here because
* that one validates against HTML5 grammar which is stricter than our
* email validation rules (we additionally allow unicode chars).
*
* We relax `type` to `"text"`, but then set `inputMode` and `autoComplete`
* to `"email"` to compensate and keep the right experience (e.g. on mobile).


export const emailFieldRules = {
required: 'Email is required',
// `type="email"` used to strip surrounding whitespace for us, `type="text"` doesn't.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like comment ad dressing old code that is weird. I don't thikn you need any kind of comment here, it is clear you are trimming because it needs trimming.

Even though Wasp offers premade [Auth UI](../ui.md) for your authentication flows, there are times when you might want more customization, so we also give you the option to create your own UI and call Wasp's auth actions from your own code, similar to how Auth UI does it under the hood.

:::note Handling the internationalized email input
We use `type="text"` with `inputMode=email` because it allows unicode/international characters, while `type=email` only allows ASCII / english letters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and autocomplete="email"?

Even though Wasp offers premade [Auth UI](../ui.md) for your authentication flows, there are times when you might want more customization, so we also give you the option to create your own UI and call Wasp's auth actions from your own code, similar to how Auth UI does it under the hood.

:::note Handling the internationalized email input
We use `type="text"` with `inputMode=email` because it allows unicode/international characters, while `type=email` only allows ASCII / english letters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so I guess if they use type=email, no big deal, they are just limiting input field more than our validator, right?

Btw you use double quotes around text but not around email.

Comment thread web/docs/auth/overview.md
Comment on lines +355 to +357
Because Wasp supports Unicode email addresses, browsers would reject their syntax with `input[type=email]`.
If you are building your own form, please use `type="text"` with `inputMode="email"` instead.
Keep in mind that `type="text"` doesn't strip surrounding whitespace the way `type="email"` does, so trim the address before you send it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is again somewhat hard to read for me.

Maybe do something like:

Since Wasp's definition of valid email addresses is wider than the HTML5 grammar (we also support unicode!), you will want to not use the usual `type="email"` attribute on `input` element (which follows HTML5 grammar and doesnt accept unicode) but instead use ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alter email validation regex to accept UTF-8 emails

4 participants