fix: update the set-password Page's translate;fix: the email & code login supports access_token & refresh_token

This commit is contained in:
NFish 2024-10-15 14:05:43 +08:00
parent f557a67556
commit 1e11c6436e
5 changed files with 12 additions and 7 deletions

View File

@ -95,7 +95,7 @@ const ChangePasswordForm = () => {
<div className='flex flex-col md:w-[400px]'>
<div className="w-full mx-auto">
<h2 className="title-4xl-semi-bold text-text-primary">
{t('login.resetPassword')}
{t('login.changePassword')}
</h2>
<p className='mt-2 body-md-regular text-text-secondary'>
{t('login.changePasswordTip')}
@ -139,7 +139,7 @@ const ChangePasswordForm = () => {
className='w-full'
onClick={handleChangePassword}
>
{t('common.operation.reset')}
{t('login.changePasswordBtn')}
</Button>
</div>
</div>

View File

@ -40,8 +40,11 @@ export default function CheckCode() {
}
setIsLoading(true)
const ret = await emailLoginWithCode({ email, code, token })
localStorage.setItem('console_token', ret.data)
router.replace(invite_token ? `/signin/invite-settings?${searchParams.toString()}` : '/apps')
if (ret.result === 'success') {
localStorage.setItem('console_token', ret.data.access_token)
localStorage.setItem('refresh_token', ret.data.refresh_token)
router.replace(invite_token ? `/signin/invite-settings?${searchParams.toString()}` : '/apps')
}
}
catch (error) { console.error(error) }
finally {

View File

@ -47,8 +47,9 @@ const translation = {
forgotPasswordDesc: 'Please enter your email address to reset your password. We will send you an email with instructions on how to reset your password.',
checkEmailForResetLink: 'Please check your email for a link to reset your password. If it doesn\'t appear within a few minutes, make sure to check your spam folder.',
passwordChanged: 'Sign in now',
changePassword: 'Change Password',
changePassword: 'Set a password',
changePasswordTip: 'Please enter a new password for your account',
changePasswordBtn: 'Set a password',
invalidToken: 'Invalid or expired token',
confirmPassword: 'Confirm Password',
confirmPasswordPlaceholder: 'Confirm your new password',

View File

@ -47,8 +47,9 @@ const translation = {
forgotPasswordDesc: '请输入您的电子邮件地址以重置密码。我们将向您发送一封电子邮件,包含如何重置密码的说明。',
checkEmailForResetLink: '请检查您的电子邮件以获取重置密码的链接。如果几分钟内没有收到,请检查您的垃圾邮件文件夹。',
passwordChanged: '立即登录',
changePassword: '更改密码',
changePassword: '设置密码',
changePasswordTip: '请输入您的新密码',
changePasswordBtn: '设置密码',
invalidToken: '无效或已过期的令牌',
confirmPassword: '确认密码',
confirmPasswordPlaceholder: '确认您的新密码',

View File

@ -327,7 +327,7 @@ export const sendEMailLoginCode = (email: string, language = 'en-US') =>
post<CommonResponse & { data: string }>('/email-code-login', { body: { email, language } })
export const emailLoginWithCode = (data: { email: string;code: string;token: string }) =>
post<CommonResponse & { data: string }>('/email-code-login/validity', { body: data })
post<LoginResponse>('/email-code-login/validity', { body: data })
export const sendResetPasswordCode = (email: string, language = 'en-US') =>
post<CommonResponse & { data: string }>('/forgot-password', { body: { email, language } })