From 65c5ed70978e49bb0eb07b78d74548f67c54058b Mon Sep 17 00:00:00 2001 From: Mirlan Date: Fri, 8 Oct 2021 12:19:06 +0600 Subject: [PATCH] fix(1750): remove password fields (#526) --- src/config/form.tsx | 3 - .../PersonalInfoForm/hooks/useUserInfo.tsx | 2 - .../hooks/useValidateForm.tsx | 7 --- .../components/PersonalInfoForm/index.tsx | 25 -------- .../components/PersonalInfoForm/styled.tsx | 60 +------------------ src/requests/saveUserInfo.tsx | 3 - 6 files changed, 2 insertions(+), 98 deletions(-) diff --git a/src/config/form.tsx b/src/config/form.tsx index b4e6ffb5..3b643c76 100644 --- a/src/config/form.tsx +++ b/src/config/form.tsx @@ -11,9 +11,6 @@ export const formIds = { initialCountryId: 'initialCountryId', language: 'language', lastname: 'lastname', - newPassword1: 'newPassword1', - newPassword2: 'newPassword2', - password: 'password', phone: 'phone', postalCode: 'postal_code', region: 'region', diff --git a/src/features/UserAccount/components/PersonalInfoForm/hooks/useUserInfo.tsx b/src/features/UserAccount/components/PersonalInfoForm/hooks/useUserInfo.tsx index a56ec3c9..e571fb04 100644 --- a/src/features/UserAccount/components/PersonalInfoForm/hooks/useUserInfo.tsx +++ b/src/features/UserAccount/components/PersonalInfoForm/hooks/useUserInfo.tsx @@ -50,7 +50,6 @@ export const useUserInfo = ({ loader, onSubmit }: Props) => { const lastname = readTrimmedValue(formIds.lastname) const language = readTrimmedValue(formIds.language) const phone = readTrimmedValue(formIds.phone) - const password = readTrimmedValue(formIds.password) const postalCode = readNumberValue(formIds.postalCode) const region = readTrimmedValue(formIds.region) const address_line1 = readTrimmedValue(formIds.address1) @@ -67,7 +66,6 @@ export const useUserInfo = ({ loader, onSubmit }: Props) => { firstname, language, lastname, - password, phone, postalCode, region, diff --git a/src/features/UserAccount/components/PersonalInfoForm/hooks/useValidateForm.tsx b/src/features/UserAccount/components/PersonalInfoForm/hooks/useValidateForm.tsx index 4194576a..df7c96d7 100644 --- a/src/features/UserAccount/components/PersonalInfoForm/hooks/useValidateForm.tsx +++ b/src/features/UserAccount/components/PersonalInfoForm/hooks/useValidateForm.tsx @@ -2,7 +2,6 @@ import trim from 'lodash/trim' import { useForm } from 'features/FormStore' import { isValidPhone } from 'helpers/isValidPhone' -import { isValidPassword } from 'helpers/isValidPassword' import { formIds } from 'config/form' @@ -17,12 +16,6 @@ export const useValidateForm = () => { const validateForm = () => { let isValid = true const phone = readTrimmedValue(formIds.phone) - const password = readTrimmedValue(formIds.password) - - if (!isValidPassword(password)) { - updateFormError(formIds.password, 'error_simple_password') - isValid = false - } if (phone && !isValidPhone(phone)) { updateFormError(formIds.phone, 'error_invalid_phone_format') diff --git a/src/features/UserAccount/components/PersonalInfoForm/index.tsx b/src/features/UserAccount/components/PersonalInfoForm/index.tsx index 14ff3bb5..547ae817 100644 --- a/src/features/UserAccount/components/PersonalInfoForm/index.tsx +++ b/src/features/UserAccount/components/PersonalInfoForm/index.tsx @@ -15,8 +15,6 @@ import { SolidButton } from '../../styled' import { Form, ButtonWrapper, - PasswordInput, - SectionTitle, PrivacyPolicyLink, } from './styled' @@ -28,9 +26,6 @@ const { firstname, formError, lastname, - newPassword1, - newPassword2, - password, phone, } = formIds @@ -118,26 +113,6 @@ export const PersonalInfoForm = (props: Props) => { maxLength={500} withError={false} /> - - - } - value={readFormValue(password)} - onChange={updateFormValue(password)} - /> - } - value={readFormValue(newPassword1)} - onChange={updateFormValue(newPassword1)} - /> - } - value={readFormValue(newPassword2)} - onChange={updateFormValue(newPassword2)} - /> {loader ? : ( theme.colors.text50}; - - @media ${devices.tablet} { - margin-top: 2rem; - font-size: 1.4rem; - line-height: 1.7rem; - } - - @media ${devices.mobile}{ - font-size: 10px; - margin-bottom: 5px; - } - -` - -export const PasswordInput = styled(PasswordInputBase)` - height: 2.4rem; - margin-bottom: 0.5rem; - padding-left: 1.1rem; - - ${InputStyled} { - padding: 0; - padding-left: 24px; - - @media ${devices.tablet} { - font-size: 1.8rem; - font-weight: 600; - } - - } - @media ${devices.tablet} { - height: 4.6rem; - margin-bottom: 1rem; - } - ${isMobileDevice - ? css` - @media (max-width: 650px){ - height: 40px; - padding-left: 10px; - } - ` - : ''}; - - -` - export const PrivacyPolicyLink = styled.a` display: inline-block; margin-top: 4px; diff --git a/src/requests/saveUserInfo.tsx b/src/requests/saveUserInfo.tsx index e1d73556..e6609f16 100644 --- a/src/requests/saveUserInfo.tsx +++ b/src/requests/saveUserInfo.tsx @@ -14,7 +14,6 @@ export type SaveUserInfo = { countryId: number | null, firstname: string | null, lastname: string | null, - password: string | null, phone: string | null, postalCode: number | null, region: string | null, @@ -38,7 +37,6 @@ export const saveUserInfo = async ({ countryId, firstname, lastname, - password, phone, postalCode, region, @@ -53,7 +51,6 @@ export const saveUserInfo = async ({ _p_country_id: countryId, _p_firstname: firstname, _p_lastname: lastname, - _p_password: password, _p_phone: phone, _p_postal_code: postalCode, _p_region: region,