diff --git a/client/src/containers/Authentication/Login.js b/client/src/containers/Authentication/Login.js
index 7bf7247f3..2c5f30723 100644
--- a/client/src/containers/Authentication/Login.js
+++ b/client/src/containers/Authentication/Login.js
@@ -2,7 +2,7 @@ import React, { useMemo, useState } from 'react';
import { Link, useHistory } from 'react-router-dom';
import * as Yup from 'yup';
import { useFormik } from 'formik';
-import { useIntl } from 'react-intl';
+import { FormattedMessage as T, useIntl } from 'react-intl';
import {
Button,
InputGroup,
@@ -13,10 +13,15 @@ import {
import Toaster from 'components/AppToaster';
import ErrorMessage from 'components/ErrorMessage';
import AuthInsider from 'containers/Authentication/AuthInsider';
+
import Icon from 'components/Icon';
+import { If } from 'components';
+
import withAuthenticationActions from './withAuthenticationActions';
+
import { compose } from 'utils';
+
const ERRORS_TYPES = {
INVALID_DETAILS: 'INVALID_DETAILS',
USER_INACTIVE: 'USER_INACTIVE',
@@ -24,7 +29,7 @@ const ERRORS_TYPES = {
function Login({
requestLogin,
}) {
- const intl = useIntl();
+ const { formatMessage } = useIntl();
const history = useHistory();
const [shown, setShown] = useState(false);
const passwordRevealer = () => { setShown(!shown); };
@@ -32,10 +37,10 @@ function Login({
// Validation schema.
const loginValidationSchema = Yup.object().shape({
crediential: Yup.string()
- .required(intl.formatMessage({ id: 'required' }))
- .email(intl.formatMessage({ id: 'invalid_email_or_phone_numner' })),
+ .required(formatMessage({ id: 'required' }))
+ .email(formatMessage({ id: 'invalid_email_or_phone_numner' })),
password: Yup.string()
- .required(intl.formatMessage({ id: 'required' }))
+ .required(formatMessage({ id: 'required' }))
.min(4),
});
@@ -64,14 +69,13 @@ function Login({
const toastBuilders = [];
if (errors.find((e) => e.type === ERRORS_TYPES.INVALID_DETAILS)) {
toastBuilders.push({
- message: `The email and password you entered did not match our records.
- Please double-check and try again.`,
+ message: formatMessage('email_and_password_entered_did_not_match'),
intent: Intent.DANGER,
});
}
if (errors.find((e) => e.type === ERRORS_TYPES.USER_INACTIVE)) {
toastBuilders.push({
- message: intl.formatMessage({ id: 'the_user_has_been_suspended_from_admin' }),
+ message: formatMessage({ id: 'the_user_has_been_suspended_from_admin' }),
intent: Intent.DANGER,
});
}
@@ -85,25 +89,26 @@ function Login({
const passwordRevealerTmp = useMemo(() => (
passwordRevealer()}>
- {(shown) ? (
- <>Hide>
- ) : (
- <>Show>
- )}
+
+ <>>
+
+
+ <>>
+ ), [shown, passwordRevealer]);
return (
-
Log in
- Need a Bigcapital account ?
- Create an account
+
+
+
@@ -146,13 +151,15 @@ function Login({
lang={true}
loading={isSubmitting}
>
- {intl.formatMessage({ id: 'Log in' })}
+
diff --git a/client/src/lang/en/index.js b/client/src/lang/en/index.js
index 2cee3671b..e45a3733a 100644
--- a/client/src/lang/en/index.js
+++ b/client/src/lang/en/index.js
@@ -8,7 +8,8 @@ export default {
'invalid_email_or_phone_numner': 'Invalid email or phone number.',
'required': 'Required',
'reset_password': 'Reset Password',
- 'the_user_has_been_suspended_from_admin': 'The user has been suspended from the administrator',
+ 'the_user_has_been_suspended_from_admin': 'The user has been suspended from the administrator.',
+ 'email_and_password_entered_did_not_match': 'The email and password you entered did not match our records.',
'field_name_must_be_number': 'field_name_must_be_number',
'name': 'Name',
"search": "Search",
@@ -19,4 +20,11 @@ export default {
'to_date': 'To date',
'accounting_basis': 'Accounting basis',
'report_date_range': 'Report date range',
+ 'log_in': 'Log in',
+ 'forget_my_password': 'Forget my password',
+ 'keep_me_logged_in': 'Keep me logged in',
+ 'create_an_account': 'Create an account',
+ 'need_bigcapital_account?': 'Need a Bigcapital account ?',
+ 'show': 'Show',
+ 'hide': 'Hide',
};
\ No newline at end of file