fix(sign-in): validate email format before registration attempt
All checks were successful
CI / build (push) Successful in 1m17s
CI / docker (push) Successful in 46s

Show "Please enter a valid email address" when the user enters a
username instead of an email in the sign-up form, rather than letting
it hit Logto's API and returning a cryptic 400.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-25 09:41:41 +02:00
parent ae1d9fa4db
commit b066d1abe7

View File

@@ -103,6 +103,10 @@ export function SignInPage() {
const handleRegister = async (e: FormEvent) => { const handleRegister = async (e: FormEvent) => {
e.preventDefault(); e.preventDefault();
setError(null); setError(null);
if (!identifier.includes('@')) {
setError('Please enter a valid email address');
return;
}
if (password !== confirmPassword) { if (password !== confirmPassword) {
setError('Passwords do not match'); setError('Passwords do not match');
return; return;