mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
feat(webapp): from phone number fields from authentication pages
This commit is contained in:
@@ -32,7 +32,7 @@ export default function LoginForm({ isSubmitting }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form>
|
||||||
<FFormGroup name={'crediential'} label={<T id={'email'} />}>
|
<FFormGroup name={'crediential'} label={<T id={'email_address'} />}>
|
||||||
<FInputGroup name={'crediential'} large={true} />
|
<FInputGroup name={'crediential'} large={true} />
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export default function RegisterForm({ isSubmitting }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form className={'authentication-page__form'}>
|
<RegisterFormRoot>
|
||||||
<Row className={'name-section'}>
|
<Row className={'name-section'}>
|
||||||
<Col md={6}>
|
<Col md={6}>
|
||||||
<FFormGroup name={'first_name'} label={<T id={'first_name'} />}>
|
<FFormGroup name={'first_name'} label={<T id={'first_name'} />}>
|
||||||
@@ -87,7 +87,7 @@ export default function RegisterForm({ isSubmitting }) {
|
|||||||
</AuthSubmitButton>
|
</AuthSubmitButton>
|
||||||
|
|
||||||
{isSubmitting && <AuthenticationLoadingOverlay />}
|
{isSubmitting && <AuthenticationLoadingOverlay />}
|
||||||
</Form>
|
</RegisterFormRoot>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,3 +95,7 @@ const TermsConditionsText = styled.p`
|
|||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
margin-bottom: 1.4rem;
|
margin-bottom: 1.4rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const RegisterFormRoot = styled(Form)`
|
||||||
|
position: relative;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ export default function SendResetPasswordForm({ isSubmitting }) {
|
|||||||
a link to reset your password.
|
a link to reset your password.
|
||||||
</TopParagraph>
|
</TopParagraph>
|
||||||
|
|
||||||
<FFormGroup
|
<FFormGroup name={'crediential'} label={<T id={'email_address'} />}>
|
||||||
name={'crediential'}
|
|
||||||
label={<T id={'email_or_phone_number'} />}
|
|
||||||
>
|
|
||||||
<FInputGroup name={'crediential'} large={true} />
|
<FInputGroup name={'crediential'} large={true} />
|
||||||
</FFormGroup>
|
</FFormGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -15,42 +15,19 @@ const REGISTER_ERRORS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const LoginSchema = Yup.object().shape({
|
export const LoginSchema = Yup.object().shape({
|
||||||
crediential: Yup.string()
|
crediential: Yup.string().required().email().label(intl.get('email')),
|
||||||
.required()
|
password: Yup.string().required().min(4).label(intl.get('password')),
|
||||||
.email()
|
|
||||||
.label(intl.get('email')),
|
|
||||||
password: Yup.string()
|
|
||||||
.required()
|
|
||||||
.min(4)
|
|
||||||
.label(intl.get('password')),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const RegisterSchema = Yup.object().shape({
|
export const RegisterSchema = Yup.object().shape({
|
||||||
first_name: Yup.string()
|
first_name: Yup.string().required().label(intl.get('first_name_')),
|
||||||
.required()
|
last_name: Yup.string().required().label(intl.get('last_name_')),
|
||||||
.label(intl.get('first_name_')),
|
email: Yup.string().email().required().label(intl.get('email')),
|
||||||
last_name: Yup.string()
|
password: Yup.string().min(4).required().label(intl.get('password')),
|
||||||
.required()
|
|
||||||
.label(intl.get('last_name_')),
|
|
||||||
email: Yup.string()
|
|
||||||
.email()
|
|
||||||
.required()
|
|
||||||
.label(intl.get('email')),
|
|
||||||
phone_number: Yup.string()
|
|
||||||
.matches()
|
|
||||||
.required()
|
|
||||||
.label(intl.get('phone_number_')),
|
|
||||||
password: Yup.string()
|
|
||||||
.min(4)
|
|
||||||
.required()
|
|
||||||
.label(intl.get('password')),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ResetPasswordSchema = Yup.object().shape({
|
export const ResetPasswordSchema = Yup.object().shape({
|
||||||
password: Yup.string()
|
password: Yup.string().min(4).required().label(intl.get('password')),
|
||||||
.min(4)
|
|
||||||
.required()
|
|
||||||
.label(intl.get('password')),
|
|
||||||
confirm_password: Yup.string()
|
confirm_password: Yup.string()
|
||||||
.oneOf([Yup.ref('password'), null])
|
.oneOf([Yup.ref('password'), null])
|
||||||
.required()
|
.required()
|
||||||
@@ -59,27 +36,17 @@ export const ResetPasswordSchema = Yup.object().shape({
|
|||||||
|
|
||||||
// Validation schema.
|
// Validation schema.
|
||||||
export const SendResetPasswordSchema = Yup.object().shape({
|
export const SendResetPasswordSchema = Yup.object().shape({
|
||||||
crediential: Yup.string()
|
crediential: Yup.string().required().email().label(intl.get('email')),
|
||||||
.required()
|
|
||||||
.email()
|
|
||||||
.label(intl.get('email')),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const InviteAcceptSchema = Yup.object().shape({
|
export const InviteAcceptSchema = Yup.object().shape({
|
||||||
first_name: Yup.string()
|
first_name: Yup.string().required().label(intl.get('first_name_')),
|
||||||
.required()
|
last_name: Yup.string().required().label(intl.get('last_name_')),
|
||||||
.label(intl.get('first_name_')),
|
|
||||||
last_name: Yup.string()
|
|
||||||
.required()
|
|
||||||
.label(intl.get('last_name_')),
|
|
||||||
phone_number: Yup.string()
|
phone_number: Yup.string()
|
||||||
.matches()
|
.matches()
|
||||||
.required()
|
.required()
|
||||||
.label(intl.get('phone_number')),
|
.label(intl.get('phone_number')),
|
||||||
password: Yup.string()
|
password: Yup.string().min(4).required().label(intl.get('password')),
|
||||||
.min(4)
|
|
||||||
.required()
|
|
||||||
.label(intl.get('password')),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export const transformSendResetPassErrorsToToasts = (errors) => {
|
export const transformSendResetPassErrorsToToasts = (errors) => {
|
||||||
@@ -92,7 +59,7 @@ export const transformSendResetPassErrorsToToasts = (errors) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
return toastBuilders;
|
return toastBuilders;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const transformLoginErrorsToToasts = (errors) => {
|
export const transformLoginErrorsToToasts = (errors) => {
|
||||||
const toastBuilders = [];
|
const toastBuilders = [];
|
||||||
@@ -109,25 +76,25 @@ export const transformLoginErrorsToToasts = (errors) => {
|
|||||||
intent: Intent.DANGER,
|
intent: Intent.DANGER,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (
|
if (errors.find((e) => e.type === LOGIN_ERRORS.LOGIN_TO_MANY_ATTEMPTS)) {
|
||||||
errors.find((e) => e.type === LOGIN_ERRORS.LOGIN_TO_MANY_ATTEMPTS)
|
|
||||||
) {
|
|
||||||
toastBuilders.push({
|
toastBuilders.push({
|
||||||
message: intl.get('your_account_has_been_locked'),
|
message: intl.get('your_account_has_been_locked'),
|
||||||
intent: Intent.DANGER,
|
intent: Intent.DANGER,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return toastBuilders;
|
return toastBuilders;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const transformRegisterErrorsToForm = (errors) => {
|
export const transformRegisterErrorsToForm = (errors) => {
|
||||||
const formErrors = {};
|
const formErrors = {};
|
||||||
|
|
||||||
if (errors.some((e) => e.type === REGISTER_ERRORS.PHONE_NUMBER_EXISTS)) {
|
if (errors.some((e) => e.type === REGISTER_ERRORS.PHONE_NUMBER_EXISTS)) {
|
||||||
formErrors.phone_number = intl.get('the_phone_number_already_used_in_another_account');
|
formErrors.phone_number = intl.get(
|
||||||
|
'the_phone_number_already_used_in_another_account',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (errors.some((e) => e.type === REGISTER_ERRORS.EMAIL_EXISTS)) {
|
if (errors.some((e) => e.type === REGISTER_ERRORS.EMAIL_EXISTS)) {
|
||||||
formErrors.email = intl.get('the_email_already_used_in_another_account');
|
formErrors.email = intl.get('the_email_already_used_in_another_account');
|
||||||
}
|
}
|
||||||
return formErrors;
|
return formErrors;
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
"register_a_new_organization": "Register a New Organization.",
|
"register_a_new_organization": "Register a New Organization.",
|
||||||
"organization_name": "Organization Name",
|
"organization_name": "Organization Name",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
|
"email_address": "Email Address",
|
||||||
"register": "Register",
|
"register": "Register",
|
||||||
"password_successfully_updated": "The Password for your account was successfully updated.",
|
"password_successfully_updated": "The Password for your account was successfully updated.",
|
||||||
"choose_a_new_password": "Choose a new password",
|
"choose_a_new_password": "Choose a new password",
|
||||||
|
|||||||
Reference in New Issue
Block a user