fix(sign-in): validate email format before registration attempt
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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user