Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[비즈니스] 비밀번호 자동완성 막기 #377

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/page/Auth/Login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function Login() {
type={isBlind ? 'text' : 'password'}
placeholder={isMobile ? '비밀번호' : '비밀번호 입력'}
{...register('password')}
autoComplete="new-password"
/>
chaeseungyun marked this conversation as resolved.
Show resolved Hide resolved
chaeseungyun marked this conversation as resolved.
Show resolved Hide resolved
<button
type="button"
Expand Down
12 changes: 10 additions & 2 deletions src/page/MyShopPage/components/BankList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OwnerShop } from 'model/shopInfo/ownerShop';
import { UseFormSetValue, UseFormRegister } from 'react-hook-form';
import { UseFormSetValue, UseFormRegister, UseFormSetFocus } from 'react-hook-form';
import { bank } from 'utils/constant/bank';
import { useEffect } from 'react';
import cn from 'utils/ts/className';
import showToast from 'utils/ts/showToast';
import styles from './index.module.scss';
Expand All @@ -11,11 +12,12 @@ interface Props {
setValue: UseFormSetValue<OwnerShop>;
bankName: string | null;
account_number: string | null;
setFocus: UseFormSetFocus<OwnerShop>;
}

const NUMBER_REGEX = /^[0-9-]+$/;
export default function BankList({
close, register, setValue, bankName, account_number,
close, register, setValue, bankName, account_number, setFocus,
}: Props) {
const validation = () => {
if (account_number && !NUMBER_REGEX.test(account_number)) {
Expand All @@ -28,6 +30,12 @@ export default function BankList({
}
close();
};

useEffect(() => {
setFocus('account_number');
// eslint-disable-next-line
}, []); // 마운트 시 한 번만 포커스

chaeseungyun marked this conversation as resolved.
Show resolved Hide resolved
chaeseungyun marked this conversation as resolved.
Show resolved Hide resolved
return (
<div className={styles.overlay} onClick={validation} role="button" aria-hidden>
<div className={styles.modal} onClick={(e) => e.stopPropagation()} role="button" aria-hidden>
Expand Down
4 changes: 3 additions & 1 deletion src/page/MyShopPage/components/EditShopInfoModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function EditShopInfoModal({
} = CheckSameTime();

const {
register, control, handleSubmit, setValue, formState: { errors },
register, control, handleSubmit, setValue, formState: { errors }, setFocus,
} = useForm<OwnerShop>({
resolver: zodResolver(OwnerShop),
defaultValues: {
Expand Down Expand Up @@ -353,6 +353,7 @@ export default function EditShopInfoModal({
account_number={account}
setValue={setValue}
close={() => setIsOpen(false)}
setFocus={setFocus}
/>
)}
<label htmlFor="description" className={styles['mobile-main-info__label']}>
Expand Down Expand Up @@ -623,6 +624,7 @@ export default function EditShopInfoModal({
account_number={account}
setValue={setValue}
close={() => setIsOpen(false)}
setFocus={setFocus}
/>
)}
</div>
Expand Down
Loading