Skip to content

Commit

Permalink
🔑 Remove password suggestion (#5222)
Browse files Browse the repository at this point in the history
* Rework useHidePasswordInInput.tsx logic

* Apply logic in required places
  • Loading branch information
WRadoslaw authored Nov 8, 2023
1 parent 32cf3e1 commit a92bf8c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const LogInModal = () => {
const [isLoading, setIsLoading] = useState(false)
const { handleLogin, refetchCurrentUser } = useAuth()
const { displaySnackbar } = useSnackbar()
const [hidePasswordProps] = useHidePasswordInInput()
const [hidePasswordProps] = useHidePasswordInInput(false)
const { trackPageView } = useSegmentAnalytics()

const setYppModalOpenName = useYppStore((state) => state.actions.setYppModalOpenName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export const SignUpPasswordStep: FC<SignUpPasswordStepProps> = ({
placeholder="Password"
{...register('password')}
{...hidePasswordProps}
autoComplete="new-password"
onClick={() => {
if (hasDoneInitialScroll.current || !dialogContentRef?.current) return
hasDoneInitialScroll.current = true
Expand Down
4 changes: 3 additions & 1 deletion packages/atlas/src/hooks/useHidePasswordInInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ import { useState } from 'react'
import { SvgActionHide, SvgActionShow } from '@/assets/icons'
import { InputProps } from '@/components/_inputs/Input'

export const useHidePasswordInInput = (): [InputProps, () => void] => {
export const useHidePasswordInInput = (isNew = true): [InputProps, () => void, boolean] => {
const [isPasswordVisible, setIsPasswordVisible] = useState(false)

return [
{
type: isPasswordVisible ? 'text' : 'password',
autoComplete: isPasswordVisible ? 'off' : isNew ? 'new-password' : 'off',
actionButton: {
icon: isPasswordVisible ? <SvgActionHide /> : <SvgActionShow />,
onClick: () => setIsPasswordVisible((isPasswordVisible) => !isPasswordVisible),
tooltipText: isPasswordVisible ? 'Hide' : 'Show',
},
},
() => setIsPasswordVisible(false),
isPasswordVisible,
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ExportSeedDialog: FC<ExportSeedDialogProps> = ({ onClose, show }) =
const { displaySnackbar } = useSnackbar()
const [isSubmitting, setIsSubmiting] = useState(false)

const [hidePasswordProps, resetHidePassword] = useHidePasswordInInput()
const [hidePasswordProps, resetHidePassword] = useHidePasswordInInput(false)

const handleClose = useCallback(() => {
reset({ password: '' })
Expand Down

0 comments on commit a92bf8c

Please sign in to comment.