feat: redesign frontend UI with MoonShadow-style dark theme
- Update color scheme to purple/blue gradient accents - Add modern card layouts with hover effects - Implement token display with copy button - Add stats dashboard on home page - Improve install page with SQLite/MySQL toggle - Add feature cards for supported functions - Improve login/register pages with centered layout - Add admin page with user management table - Add responsive grid layouts - Add fade-in animations
This commit is contained in:
+37
-20
@@ -1,9 +1,10 @@
|
||||
import { useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
export default function RegisterPage() {
|
||||
const [username, setUsername] = useState('')
|
||||
const [password, setPassword] = useState('')
|
||||
const [code, setCode] = useState('')
|
||||
const [confirmPassword, setConfirmPassword] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
const [success, setSuccess] = useState('')
|
||||
const [loading, setLoading] = useState(false)
|
||||
@@ -12,35 +13,50 @@ export default function RegisterPage() {
|
||||
e.preventDefault()
|
||||
setError('')
|
||||
setSuccess('')
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
setError('两次密码不一致')
|
||||
return
|
||||
}
|
||||
|
||||
setLoading(true)
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/register', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ username, password, registration_code: code }),
|
||||
body: JSON.stringify({ username, password })
|
||||
})
|
||||
|
||||
const data = await res.json()
|
||||
|
||||
if (!res.ok) {
|
||||
if (res.ok) {
|
||||
setSuccess('注册成功,请登录')
|
||||
setTimeout(() => {
|
||||
window.location.href = '/login'
|
||||
}, 1500)
|
||||
} else {
|
||||
setError(data.error || '注册失败')
|
||||
return
|
||||
}
|
||||
|
||||
setSuccess('注册成功,请登录')
|
||||
setTimeout(() => window.location.href = '/login', 2000)
|
||||
} catch {
|
||||
setError('网络错误')
|
||||
setError('网络错误,请重试')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container" style={{ maxWidth: '400px', marginTop: '100px' }}>
|
||||
<div className="card">
|
||||
<h1 style={{ marginBottom: '24px', textAlign: 'center' }}>注册</h1>
|
||||
<div className="container-sm">
|
||||
<div className="text-center mb-6" style={{ paddingTop: '80px' }}>
|
||||
<div className="logo" style={{ width: '48px', height: '48px', fontSize: '20px', margin: '0 auto 16px' }}>
|
||||
AC
|
||||
</div>
|
||||
<h1 className="page-title">AntiCaptcha</h1>
|
||||
<p className="text-secondary">验证码识别服务平台</p>
|
||||
</div>
|
||||
|
||||
<div className="card fade-in">
|
||||
<h2 className="text-lg mb-4 text-center">注册</h2>
|
||||
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="form-group">
|
||||
@@ -68,27 +84,28 @@ export default function RegisterPage() {
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label className="label">注册码</label>
|
||||
<label className="label">确认密码</label>
|
||||
<input
|
||||
type="text"
|
||||
type="password"
|
||||
className="input"
|
||||
value={code}
|
||||
onChange={e => setCode(e.target.value)}
|
||||
placeholder="请输入注册码"
|
||||
value={confirmPassword}
|
||||
onChange={e => setConfirmPassword(e.target.value)}
|
||||
placeholder="请再次输入密码"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
{error && <div className="error">{error}</div>}
|
||||
{success && <div className="success">{success}</div>}
|
||||
{error && <div className="error mb-4">{error}</div>}
|
||||
{success && <div className="success mb-4">{success}</div>}
|
||||
|
||||
<button type="submit" className="button" style={{ width: '100%' }} disabled={loading}>
|
||||
<button type="submit" className="button button-block button-lg" disabled={loading}>
|
||||
{loading ? '注册中...' : '注册'}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div className="text-center mt-4">
|
||||
<a href="/login" style={{ color: 'var(--primary)' }}>已有账号?立即登录</a>
|
||||
<span className="text-secondary">已有账号?</span>{' '}
|
||||
<Link to="/login">立即登录</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user