This commit is contained in:
parent
c6a825c284
commit
f86e3b4725
@ -3,7 +3,7 @@ import EmailAuthForm2 from '@/app/auth/email2/auth-form';
|
||||
|
||||
export default function RegisterPage() {
|
||||
return (
|
||||
<div className='container w-[496px] py-8'>
|
||||
<div className='container w-full py-8 sm:w-[496px]'>
|
||||
<EmailAuthForm2 isRedirect={true} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@ -14,7 +14,6 @@ import {
|
||||
import { Input } from '@workspace/airo-ui/components/input';
|
||||
import { Icon } from '@workspace/airo-ui/custom-components/icon';
|
||||
import { Markdown } from '@workspace/airo-ui/custom-components/markdown';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
@ -35,7 +34,6 @@ export default function RegisterForm({
|
||||
setInitialValues: Dispatch<SetStateAction<any>>;
|
||||
onSwitchForm: Dispatch<SetStateAction<'register' | 'reset' | 'login'>>;
|
||||
}) {
|
||||
const t = useTranslations('auth.register');
|
||||
const { common } = useGlobalStore();
|
||||
const { verify, auth, invite } = common;
|
||||
const router = useRouter();
|
||||
@ -53,12 +51,9 @@ export default function RegisterForm({
|
||||
|
||||
const formSchema = z
|
||||
.object({
|
||||
email: z
|
||||
.string()
|
||||
.email(t('email'))
|
||||
.refine(handleCheckUser, {
|
||||
message: t('whitelist'),
|
||||
}),
|
||||
email: z.string().email('请输入有效的电子邮件地址。').refine(handleCheckUser, {
|
||||
message: '电子邮件域名不在允许的白名单中。',
|
||||
}),
|
||||
password: z.string().min(1, '请输入密码'), // 必填提示
|
||||
repeat_password: z.string().min(1, '请重复输入密码'), // 必填
|
||||
code: auth.email.enable_verify
|
||||
@ -74,7 +69,7 @@ export default function RegisterForm({
|
||||
if (password !== repeat_password) {
|
||||
ctx.addIssue({
|
||||
code: z.ZodIssueCode.custom,
|
||||
message: t('passwordMismatch'),
|
||||
message: '两次密码输入不一致',
|
||||
path: ['repeat_password'],
|
||||
});
|
||||
}
|
||||
@ -109,7 +104,7 @@ export default function RegisterForm({
|
||||
<div className={'h-[84px] text-2xl font-bold leading-[84px]'}>线路优化</div>
|
||||
|
||||
{auth.register.stop_register ? (
|
||||
<Markdown>{t('message')}</Markdown>
|
||||
<Markdown>尊敬的用户,您好</Markdown>
|
||||
) : (
|
||||
<Form {...form}>
|
||||
<form onSubmit={handleSubmit}>
|
||||
@ -232,7 +227,7 @@ export default function RegisterForm({
|
||||
</div>
|
||||
|
||||
<div className='text-right text-sm'>
|
||||
{t('existingAccount')}
|
||||
已有账户?
|
||||
<Button
|
||||
variant='link'
|
||||
type='button'
|
||||
@ -241,7 +236,7 @@ export default function RegisterForm({
|
||||
router.replace('/');
|
||||
}}
|
||||
>
|
||||
{t('switchToLogin')}
|
||||
登录
|
||||
</Button>
|
||||
</div>
|
||||
<div className='mt-6 flex justify-center'>
|
||||
@ -251,7 +246,7 @@ export default function RegisterForm({
|
||||
className='h-auto min-w-[157px] py-2 text-lg font-medium'
|
||||
>
|
||||
{loading && <Icon icon='mdi:loading' className='animate-spin' />}
|
||||
{t('title')}
|
||||
注册
|
||||
</AiroButton>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user