fix(auth): trim whitespace from email/phone identifiers before submit - #3239
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
…#3238) Autofill and copy-paste routinely smuggle leading/trailing whitespace into the login identifier; the server then rejects it as "Invalid email". Trim the identifier at every submit path — LoginForm (password, phone+password routing, SSO request body), RegisterForm (signUp + verification callback), and ForgotPasswordForm (reset request) — while leaving the input value as typed. Phone-OTP paths already trimmed. Closes #3238 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
登录页中,用户输入的邮箱/手机号带前后空格(移动端自动补全、复制粘贴常见)时会原样提交,服务端报 "Invalid email",用户很难察觉是空格问题。注册、忘记密码表单同样受影响。
改动
均在
packages/auth,只在提交消费处 trim,输入框内保持用户原始输入不变:handleSubmit取identifier = email.trim(),后续手机号判定(looksLikePhoneIdentifier)、signInWithPhonePassword、signIn均用 trim 后的值;handleSso的判定与/sign-in/sso请求体同样用 trim 后的 email。手机 OTP 路径原本已 trim,不动。signUp与onVerificationRequired回调改传 trim 后的 email。forgotPassword(email.trim())。测试
type-check通过。Closes #3238
🤖 Generated with Claude Code