| | |
| | | import Loading from '../components/base/loading' |
| | | import Input from '../components/base/input' |
| | | import Button from '@/app/components/base/button' |
| | | import { WEB_PREFIX } from '@/config' |
| | | |
| | | import { |
| | | fetchInitValidateStatus, |
| | | fetchSetupStatus, |
| | | sendForgotPasswordEmail, |
| | | } from '@/service/common' |
| | | import type { InitValidateStatusResponse } from '@/models/common' |
| | | import type { InitValidateStatusResponse, SetupStatusResponse } from '@/models/common' |
| | | |
| | | const accountFormSchema = z.object({ |
| | | email: z |
| | |
| | | } |
| | | |
| | | useEffect(() => { |
| | | fetchSetupStatus().then(() => { |
| | | fetchSetupStatus().then((res: SetupStatusResponse) => { |
| | | fetchInitValidateStatus().then((res: InitValidateStatusResponse) => { |
| | | if (res.status === 'not_started') |
| | | window.location.href = `${WEB_PREFIX}/init` |
| | | window.location.href = '/init' |
| | | }) |
| | | |
| | | setLoading(false) |
| | |
| | | ? <Loading /> |
| | | : <> |
| | | <div className="sm:mx-auto sm:w-full sm:max-w-md"> |
| | | <h2 className="text-[32px] font-bold text-text-primary"> |
| | | <h2 className="text-[32px] font-bold text-gray-900"> |
| | | {isEmailSent ? t('login.resetLinkSent') : t('login.forgotPassword')} |
| | | </h2> |
| | | <p className='mt-1 text-sm text-text-secondary'> |
| | | <p className='mt-1 text-sm text-gray-600'> |
| | | {isEmailSent ? t('login.checkEmailForResetLink') : t('login.forgotPasswordDesc')} |
| | | </p> |
| | | </div> |
| | | <div className="mt-8 grow sm:mx-auto sm:w-full sm:max-w-md"> |
| | | <div className="relative"> |
| | | <div className="grow mt-8 sm:mx-auto sm:w-full sm:max-w-md"> |
| | | <div className="bg-white "> |
| | | <form> |
| | | {!isEmailSent && ( |
| | | <div className='mb-5'> |
| | | <label htmlFor="email" |
| | | className="my-2 flex items-center justify-between text-sm font-medium text-text-primary"> |
| | | className="my-2 flex items-center justify-between text-sm font-medium text-gray-900"> |
| | | {t('login.email')} |
| | | </label> |
| | | <div className="mt-1"> |
| | |
| | | {...register('email')} |
| | | placeholder={t('login.emailPlaceholder') || ''} |
| | | /> |
| | | {errors.email && <span className='text-sm text-red-400'>{t(`${errors.email?.message}`)}</span>} |
| | | {errors.email && <span className='text-red-400 text-sm'>{t(`${errors.email?.message}`)}</span>} |
| | | </div> |
| | | </div> |
| | | )} |