-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 비밀번호 찾기 초기 페이지 구성 * feat: 비밀번호 찾기 문자인증 api 생성 * feat: 문자 인증 response 인터페이스 추가 * feat: 비밀번호 찾기 문자 인증 페이지 완성 * refactor: 비밀번호 변경 api 생성 및 타입 생성 * feat: 비밀번호 변경 페이지 완성 * feat: 비밀번호 찾기 페이지 추가 * refactor: warning 아이콘 추가 * chore: scss 파일 위치 수정 * chore: 불필요한 파일 삭제 및 적용 * refactor: import cycle 해결 * fix: lint 에러 수정 * refactor: 사용자 입력으로 오류 수정 시 에러 초기화 * feat: useDebounce 훅 추가 * refactor: 오류 처리 및 useDebouce 적용 * refactor: 코드 가독성 향상
- Loading branch information
1 parent
02e8c60
commit c271225
Showing
20 changed files
with
508 additions
and
577 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { useEffect } from 'react'; | ||
import { useFormContext } from 'react-hook-form'; | ||
import { useOutletContext } from 'react-router-dom'; | ||
import { ChangePasswordForm } from 'model/auth'; | ||
import { OutletProps } from 'page/Auth/FindPassword/entity'; | ||
import { ReactComponent as Warning } from 'assets/svg/auth/warning.svg'; | ||
import styles from 'page/Auth/FindPassword/index.module.scss'; | ||
|
||
const passwordRegex = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{6,18}$/; | ||
|
||
export default function ChangePassword() { | ||
const { | ||
register, formState: { errors, isValid }, getValues, clearErrors, | ||
} = useFormContext<ChangePasswordForm>(); | ||
|
||
const steps: OutletProps = useOutletContext(); | ||
const { setIsStepComplete } = steps; | ||
|
||
useEffect(() => { | ||
if (isValid) { | ||
clearErrors(); | ||
setIsStepComplete(true); | ||
} else { | ||
setIsStepComplete(false); | ||
} | ||
}); | ||
|
||
return ( | ||
<form className={styles.container}> | ||
<section className={styles.section}> | ||
<div className={styles.title}>새 비밀번호</div> | ||
<input | ||
className={styles.input} | ||
type="password" | ||
placeholder="새 비밀번호를 입력해주세요." | ||
{...register('password', { | ||
required: { | ||
value: true, | ||
message: '필수 입력 항목입니다.', | ||
}, | ||
pattern: { | ||
value: passwordRegex, | ||
message: '특수문자 포함 영어와 숫자 6~18 자리로 입력해주세요.', | ||
}, | ||
})} | ||
/> | ||
{ | ||
errors.password | ||
? ( | ||
<div className={styles.error}> | ||
<Warning /> | ||
{errors.password.message} | ||
</div> | ||
) : ( | ||
<div className={styles.comment}> | ||
* 특수문자 포함 영어와 숫자 6~18 자리 | ||
</div> | ||
) | ||
} | ||
|
||
</section> | ||
<section className={styles.section}> | ||
<div className={styles.title}>새 비밀번호 확인</div> | ||
<input | ||
className={styles.input} | ||
type="password" | ||
placeholder="새 비밀번호를 다시 입력해주세요." | ||
{...register('passwordCheck', { | ||
validate: (value) => value === getValues('password') || '비밀번호가 일치하지 않습니다.', | ||
})} | ||
/> | ||
{ | ||
errors.passwordCheck && ( | ||
<div className={styles.error}> | ||
<Warning /> | ||
{errors.passwordCheck.message} | ||
</div> | ||
) | ||
} | ||
</section> | ||
</form> | ||
); | ||
} |
51 changes: 0 additions & 51 deletions
51
src/page/Auth/FindPassword/CompleteChangePassword/CompleteChangePassword.module.scss
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
src/page/Auth/FindPassword/CompleteChangePassword/index.tsx
This file was deleted.
Oops, something went wrong.
107 changes: 0 additions & 107 deletions
107
src/page/Auth/FindPassword/NewPassword/NewPassword.module.scss
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.