diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 7e1b5ecb6..2aef92713 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -10,6 +10,7 @@ import * as Yup from 'yup';
import { getOtt } from 'services/userService';
import Container from 'components/Container';
import { setData, LS_KEYS, getData } from 'utils/storage/localStorage';
+import { Alert } from 'react-bootstrap';
interface formValues {
email: string;
@@ -18,6 +19,7 @@ interface formValues {
export default function Home() {
const [loading, setLoading] = useState(false);
const router = useRouter();
+ const [showMessage, setShowMessage] = useState(false);
useEffect(() => {
router.prefetch('/verify');
@@ -38,77 +40,91 @@ export default function Home() {
setData(LS_KEYS.USER, { email });
router.push('/verify');
} catch (e) {
- setFieldError('email', `${constants.UNKNOWN_ERROR} ${e.message}`);
+ if (e.response.status == 403) {
+ setFieldError('email', `${constants.USER_DOESNOT_EXIST}`);
+ } else {
+ setFieldError(
+ 'email',
+ `${constants.UNKNOWN_ERROR} ${e.message}`
+ );
+ }
}
setLoading(false);
};
const register = () => {
- router.push('/signup');
+ setShowMessage(true);
+ setTimeout(() => setShowMessage(false), 15000);
};
return (
-
-
-
-
- {constants.LOGIN}
-
-
- initialValues={{ email: '' }}
- validationSchema={Yup.object().shape({
- email: Yup.string()
- .email(constants.EMAIL_ERROR)
- .required(constants.REQUIRED),
- })}
- onSubmit={loginUser}
- >
- {({
- values,
- errors,
- touched,
- handleChange,
- handleBlur,
- handleSubmit,
- }) => (
-
-
+
+
{constants.WEB_SIGNUPS_DISABLED}
+
+
+
+
+
+
+ {constants.LOGIN}
+
+
+ initialValues={{ email: '' }}
+ validationSchema={Yup.object().shape({
+ email: Yup.string()
+ .email(constants.EMAIL_ERROR)
+ .required(constants.REQUIRED),
+ })}
+ onSubmit={loginUser}
+ >
+ {({
+ values,
+ errors,
+ touched,
+ handleChange,
+ handleBlur,
+ handleSubmit,
+ }) => (
+
+
+
+ {errors.email}
+
+
+
-
- {errors.email}
-
-
-
-
- )}
-
-
- Don't have an account?
-
-
-
-
+ style={{ marginBottom: '12px' }}
+ >
+ {constants.SUBMIT}
+
+
+ )}
+
+
+ Don't have an account?
+
+
+
+
+ >
);
}