引入 husky,并全局重新格式化
This commit is contained in:
@@ -14,7 +14,7 @@ function generateCaptchaText(length: number = 4): string {
|
||||
}
|
||||
|
||||
// 哈希验证码文本并使用随机盐值
|
||||
function hashCaptcha(text: string): { hash: string, salt: string } {
|
||||
function hashCaptcha(text: string): {hash: string, salt: string} {
|
||||
const salt = crypto.randomBytes(16).toString('hex')
|
||||
const hash = crypto
|
||||
.createHmac('sha256', salt)
|
||||
|
||||
@@ -63,7 +63,7 @@ export default function Captcha(props: CaptchaProps) {
|
||||
<Input
|
||||
placeholder="请输入图形验证码"
|
||||
value={captchaCode}
|
||||
onChange={(e) => setCaptchaCode(e.target.value)}
|
||||
onChange={e => setCaptchaCode(e.target.value)}
|
||||
className="w-full"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
import { ReactNode } from 'react'
|
||||
import { Metadata } from 'next'
|
||||
import {ReactNode} from 'react'
|
||||
import {Metadata} from 'next'
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return {
|
||||
@@ -9,9 +8,9 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
}
|
||||
|
||||
export type LoginLayoutProps = {
|
||||
children: ReactNode
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export default async function LoginLayout(props: LoginLayoutProps) {
|
||||
return props.children
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ export default function LoginPage(props: LoginPageProps) {
|
||||
const params = useSearchParams()
|
||||
const redirect = params.get('redirect')
|
||||
|
||||
const refreshProfile = useProfileStore(store=>store.refreshProfile)
|
||||
const refreshProfile = useProfileStore(store => store.refreshProfile)
|
||||
|
||||
// ======================
|
||||
// render
|
||||
@@ -205,9 +205,9 @@ export default function LoginPage(props: LoginPageProps) {
|
||||
`h-screen w-screen xl:pr-64 bg-cover bg-left`,
|
||||
`flex justify-center xl:justify-end items-center`,
|
||||
)}>
|
||||
<Image src={bg} alt={`背景图`} fill priority className={`absolute -z-10 object-cover`}/>
|
||||
<Image src={bg} alt="背景图" fill priority className="absolute -z-10 object-cover"/>
|
||||
|
||||
<Image src={logo} alt={`logo`} priority height={64} className={`absolute top-8 left-8`}/>
|
||||
<Image src={logo} alt="logo" priority height={64} className="absolute top-8 left-8"/>
|
||||
|
||||
{/* 登录表单 */}
|
||||
<Card className="w-96 mx-4 shadow-lg">
|
||||
@@ -215,9 +215,9 @@ export default function LoginPage(props: LoginPageProps) {
|
||||
<CardTitle className="text-2xl">登录/注册</CardTitle>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className={`px-8`}>
|
||||
<CardContent className="px-8">
|
||||
<Form<FormValues> className="space-y-6" onSubmit={onSubmit} form={form}>
|
||||
<FormField name="username" label={`手机号码`}>
|
||||
<FormField name="username" label="手机号码">
|
||||
{({id, field}) => (
|
||||
<Input
|
||||
{...field}
|
||||
@@ -229,7 +229,7 @@ export default function LoginPage(props: LoginPageProps) {
|
||||
)}
|
||||
</FormField>
|
||||
|
||||
<FormField name="password" label={`验证码`}>
|
||||
<FormField name="password" label="验证码">
|
||||
{({id, field}) => (
|
||||
<div className="flex space-x-4">
|
||||
<Input
|
||||
@@ -277,7 +277,10 @@ export default function LoginPage(props: LoginPageProps) {
|
||||
</Button>
|
||||
|
||||
<p className="text-xs text-center text-gray-500">
|
||||
登录即表示您同意<a href="#" className="text-blue-600 hover:text-blue-500">《用户协议》</a>和<a href="#" className="text-blue-600 hover:text-blue-500">《隐私政策》</a>
|
||||
登录即表示您同意
|
||||
<a href="#" className="text-blue-600 hover:text-blue-500">《用户协议》</a>
|
||||
和
|
||||
<a href="#" className="text-blue-600 hover:text-blue-500">《隐私政策》</a>
|
||||
</p>
|
||||
</div>
|
||||
</Form>
|
||||
|
||||
Reference in New Issue
Block a user