fix(1750): remove password fields (#526)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 4 years ago
parent 4bd42f6922
commit 65c5ed7097
  1. 3
      src/config/form.tsx
  2. 2
      src/features/UserAccount/components/PersonalInfoForm/hooks/useUserInfo.tsx
  3. 7
      src/features/UserAccount/components/PersonalInfoForm/hooks/useValidateForm.tsx
  4. 25
      src/features/UserAccount/components/PersonalInfoForm/index.tsx
  5. 60
      src/features/UserAccount/components/PersonalInfoForm/styled.tsx
  6. 3
      src/requests/saveUserInfo.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',

@ -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,

@ -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')

@ -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}
/>
<SectionTitle><T9n t='change_password' /></SectionTitle>
<PasswordInput
type='password'
leftContent={<T9n t='password_current' />}
value={readFormValue(password)}
onChange={updateFormValue(password)}
/>
<PasswordInput
type='password'
leftContent={<T9n t='password_new' />}
value={readFormValue(newPassword1)}
onChange={updateFormValue(newPassword1)}
/>
<PasswordInput
type='password'
leftContent={<T9n t='password_repeat' />}
value={readFormValue(newPassword2)}
onChange={updateFormValue(newPassword2)}
/>
<ButtonWrapper>
{loader ? <ArrowLoader disabled width='204px' /> : (
<SolidButton

@ -4,8 +4,6 @@ import { devices } from 'config/devices'
import { isMobileDevice } from 'config/userAgent'
import { Column, InputWrapper } from 'features/Common/Input/styled'
import { PasswordInput as PasswordInputBase } from 'features/Common'
import { InputStyled } from 'features/Common/NewInput/styled'
export const Form = styled.div`
padding-top: 26px;
@ -19,7 +17,7 @@ export const Form = styled.div`
height: 2.4rem;
margin-top: 0.5rem;
@media ${devices.tablet} {
height: 4.6rem;
margin-top: 1rem;
@ -39,7 +37,7 @@ export const Form = styled.div`
@media ${devices.tablet} {
width: 100%;
}
${isMobileDevice
? css`
width: 100%;
@ -59,60 +57,6 @@ export const ButtonWrapper = styled.div`
margin-top: 1.9rem;
`
export const SectionTitle = styled.span`
display: inline-block;
margin-top: 0.9rem;
margin-bottom: 4px;
font-weight: 600;
font-size: 0.6rem;
line-height: 0.9rem;
text-transform: uppercase;
color: ${({ theme }) => 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;

@ -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,

Loading…
Cancel
Save