mirror of
https://github.com/stackblitz/bolt.new
synced 2025-06-26 18:17:50 +00:00
feat: 移除手机号验证功能
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useNavigate } from '@remix-run/react';
|
||||
import { validatePhoneNumber } from '~/utils/validation';
|
||||
|
||||
export function Login() {
|
||||
const [phone, setPhone] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [phoneError, setPhoneError] = useState('');
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!validatePhoneNumber(phone)) {
|
||||
setPhoneError('请输入有效的手机号码');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch('/api/auth/login', {
|
||||
method: 'POST',
|
||||
@@ -42,14 +36,10 @@ export function Login() {
|
||||
type="tel"
|
||||
id="phone"
|
||||
value={phone}
|
||||
onChange={(e) => {
|
||||
setPhone(e.target.value);
|
||||
setPhoneError('');
|
||||
}}
|
||||
onChange={(e) => setPhone(e.target.value)}
|
||||
required
|
||||
className="mt-1 block w-full px-3 py-2 bg-bolt-elements-background-depth-1 border border-bolt-elements-borderColor rounded-md shadow-sm focus:outline-none focus:ring-bolt-elements-button-primary-background focus:border-bolt-elements-button-primary-background"
|
||||
/>
|
||||
{phoneError && <p className="mt-2 text-sm text-red-600">{phoneError}</p>}
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="password" className="block text-sm font-medium text-bolt-elements-textPrimary">
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useNavigate } from '@remix-run/react';
|
||||
import { validatePhoneNumber } from '~/utils/validation';
|
||||
|
||||
export function Register() {
|
||||
const [phone, setPhone] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [confirmPassword, setConfirmPassword] = useState('');
|
||||
const [phoneError, setPhoneError] = useState('');
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!validatePhoneNumber(phone)) {
|
||||
setPhoneError('请输入有效的手机号码');
|
||||
return;
|
||||
}
|
||||
if (password !== confirmPassword) {
|
||||
alert('两次输入的密码不一致');
|
||||
return;
|
||||
@@ -45,14 +39,10 @@ export function Register() {
|
||||
type="tel"
|
||||
id="phone"
|
||||
value={phone}
|
||||
onChange={(e) => {
|
||||
setPhone(e.target.value);
|
||||
setPhoneError('');
|
||||
}}
|
||||
onChange={(e) => setPhone(e.target.value)}
|
||||
required
|
||||
className="mt-1 block w-full px-3 py-2 bg-bolt-elements-background-depth-1 border border-bolt-elements-borderColor rounded-md shadow-sm focus:outline-none focus:ring-bolt-elements-button-primary-background focus:border-bolt-elements-button-primary-background"
|
||||
/>
|
||||
{phoneError && <p className="mt-2 text-sm text-red-600">{phoneError}</p>}
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="password" className="block text-sm font-medium text-bolt-elements-textPrimary">
|
||||
|
||||
Reference in New Issue
Block a user