Update RegisterForm.js

This commit is contained in:
analogpvt 2023-05-20 12:14:55 +05:30 committed by GitHub
parent 939e0bd941
commit ce055667c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,16 +50,16 @@ const RegisterForm = () => {
async function handleSubmit(e) { async function handleSubmit(e) {
if (password.length < 8) { if (password.length < 8) {
showInfo('密码长度不得小于 8 位'); showInfo('Password must be at least 8 characters in length');
return; return;
} }
if (password !== password2) { if (password !== password2) {
showInfo('两次输入的密码不一致'); showInfo('The two entered passwords do not match.');
return; return;
} }
if (username && password) { if (username && password) {
if (turnstileEnabled && turnstileToken === '') { if (turnstileEnabled && turnstileToken === '') {
showInfo('请稍后几秒重试Turnstile 正在检查用户环境'); showInfo('Please wait for a few seconds and try again, Turnstile is checking the user environment');
return; return;
} }
setLoading(true); setLoading(true);
@ -70,7 +70,7 @@ const RegisterForm = () => {
const { success, message } = res.data; const { success, message } = res.data;
if (success) { if (success) {
navigate('/login'); navigate('/login');
showSuccess('注册成功'); showSuccess('Registration successful');
} else { } else {
showError(message); showError(message);
} }
@ -81,7 +81,7 @@ const RegisterForm = () => {
const sendVerificationCode = async () => { const sendVerificationCode = async () => {
if (inputs.email === '') return; if (inputs.email === '') return;
if (turnstileEnabled && turnstileToken === '') { if (turnstileEnabled && turnstileToken === '') {
showInfo('请稍后几秒重试Turnstile 正在检查用户环境'); showInfo('Please wait a few seconds and try again, Turnstile is checking the user environment');
return; return;
} }
setLoading(true); setLoading(true);
@ -90,7 +90,7 @@ const RegisterForm = () => {
); );
const { success, message } = res.data; const { success, message } = res.data;
if (success) { if (success) {
showSuccess('验证码发送成功,请检查你的邮箱'); showSuccess('Verification code sent successfully, please check your email');
} else { } else {
showError(message); showError(message);
} }
@ -101,7 +101,7 @@ const RegisterForm = () => {
<Grid textAlign='center' style={{ marginTop: '48px' }}> <Grid textAlign='center' style={{ marginTop: '48px' }}>
<Grid.Column style={{ maxWidth: 450 }}> <Grid.Column style={{ maxWidth: 450 }}>
<Header as='h2' color='' textAlign='center'> <Header as='h2' color='' textAlign='center'>
<Image src={logo} /> 新用户注册 <Image src={logo} /> New User Registration
</Header> </Header>
<Form size='large'> <Form size='large'>
<Segment> <Segment>
@ -109,7 +109,7 @@ const RegisterForm = () => {
fluid fluid
icon='user' icon='user'
iconPosition='left' iconPosition='left'
placeholder='输入用户名,最长 12 位' placeholder='Enter your username, up to 12 characters.'
onChange={handleChange} onChange={handleChange}
name='username' name='username'
/> />
@ -117,7 +117,7 @@ const RegisterForm = () => {
fluid fluid
icon='lock' icon='lock'
iconPosition='left' iconPosition='left'
placeholder='输入密码,最短 8 位,最长 20 位' placeholder='Enter your password with a minimum of 8 characters and a maximum of 20 characters.'
onChange={handleChange} onChange={handleChange}
name='password' name='password'
type='password' type='password'
@ -126,7 +126,7 @@ const RegisterForm = () => {
fluid fluid
icon='lock' icon='lock'
iconPosition='left' iconPosition='left'
placeholder='输入密码,最短 8 位,最长 20 位' placeholder='Enter your password, with a minimum of 8 characters and a maximum of 20 characters.'
onChange={handleChange} onChange={handleChange}
name='password2' name='password2'
type='password' type='password'
@ -137,13 +137,13 @@ const RegisterForm = () => {
fluid fluid
icon='mail' icon='mail'
iconPosition='left' iconPosition='left'
placeholder='输入邮箱地址' placeholder='Enter your email address'
onChange={handleChange} onChange={handleChange}
name='email' name='email'
type='email' type='email'
action={ action={
<Button onClick={sendVerificationCode} disabled={loading}> <Button onClick={sendVerificationCode} disabled={loading}>
获取验证码 Get Verification Code
</Button> </Button>
} }
/> />
@ -151,7 +151,7 @@ const RegisterForm = () => {
fluid fluid
icon='lock' icon='lock'
iconPosition='left' iconPosition='left'
placeholder='输入验证码' placeholder='Enter verification code'
onChange={handleChange} onChange={handleChange}
name='verification_code' name='verification_code'
/> />
@ -176,14 +176,14 @@ const RegisterForm = () => {
onClick={handleSubmit} onClick={handleSubmit}
loading={loading} loading={loading}
> >
注册 Registration
</Button> </Button>
</Segment> </Segment>
</Form> </Form>
<Message> <Message>
已有账户 Already have an account?
<Link to='/login' className='btn btn-link'> <Link to='/login' className='btn btn-link'>
点击登录 Click to login
</Link> </Link>
</Message> </Message>
</Grid.Column> </Grid.Column>