-
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.
Merge pull request #25 from Codeit-TripProduct-9team/feat-findPw
✨Feat: 이메일 인증 모달
- Loading branch information
Showing
9 changed files
with
203 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
import { useRouter } from 'next/router'; | ||
import { useState } from 'react'; | ||
|
||
type ModalProps = { | ||
isOpen: boolean; | ||
close: () => void; | ||
code: string; | ||
}; | ||
|
||
const EmailConfirmModal = ({ isOpen, close, code }: ModalProps) => { | ||
const [inputCode, setInputCode] = useState(''); //리엑트 훅 폼으로 사용 변경 필요 | ||
const router = useRouter(); | ||
|
||
const handleConfirm = () => { | ||
if (inputCode === code) { | ||
alert('이메일 인증이 완료되었습니다.'); | ||
close(); | ||
router.push('/reset-password/change-password'); // 비밀번호 변경 페이지로 이동 | ||
} else { | ||
alert('인증 코드가 일치하지 않습니다.'); | ||
} | ||
}; | ||
|
||
//스타일은 임시로 지피티의 도움^3^ | ||
return ( | ||
<> | ||
{isOpen && ( | ||
<div className="fixed inset-0 bg-black bg-opacity-50 flex justify-center items-center"> | ||
<div className="bg-white p-5 rounded"> | ||
<h2 className="text-xl mb-4">인증 코드 입력</h2> | ||
<input | ||
type="text" | ||
value={inputCode} | ||
onChange={(e) => setInputCode(e.target.value)} | ||
className="border p-2 mb-4" | ||
/> | ||
<div className="flex justify-end"> | ||
<button onClick={handleConfirm} className="bg-blue-500 text-white p-2 rounded mr-2"> | ||
확인 | ||
</button> | ||
<button onClick={close} className="bg-gray-500 text-white p-2 rounded"> | ||
취소 | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default EmailConfirmModal; |
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,61 @@ | ||
import { FieldError, useForm } from 'react-hook-form'; | ||
import PasswordInput from '../../common/input/passwordInput'; | ||
|
||
type ChangePwForm = { | ||
text?: string; | ||
email: string; | ||
password: string; | ||
newpassword?: string; | ||
passwordcheck?: string; | ||
checkbox?: boolean; | ||
file?: string; | ||
nickname?: string; | ||
}; | ||
|
||
const ChangePwContent = () => { | ||
const { | ||
register, | ||
formState: { errors }, | ||
handleSubmit, | ||
clearErrors, | ||
// setError, | ||
} = useForm<ChangePwForm>({ mode: 'onBlur', reValidateMode: 'onBlur' }); | ||
|
||
const handleChangePassword = () => { | ||
//async | ||
}; | ||
return ( | ||
<form onSubmit={handleSubmit(handleChangePassword)}> | ||
<PasswordInput | ||
register={register('password', { | ||
required: { | ||
value: true, | ||
message: '비밀번호를 입력해주세요.', | ||
}, | ||
})} | ||
type="password" | ||
clearError={clearErrors} | ||
error={errors.password as FieldError} | ||
inputName="password" | ||
inputContent="비밀번호" | ||
labelId="password" | ||
/> | ||
<PasswordInput | ||
register={register('password', { | ||
required: { | ||
value: true, | ||
message: '비밀번호를 다시 입력해주세요.', | ||
}, | ||
})} | ||
type="password" | ||
clearError={clearErrors} | ||
error={errors.password as FieldError} | ||
inputName="checkPassword" | ||
inputContent="비밀번호" | ||
labelId="checkPassword" | ||
/> | ||
</form> | ||
); | ||
}; | ||
|
||
export default ChangePwContent; |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import '@/src/styles/globals.css'; | ||
import type { AppProps } from 'next/app'; | ||
import { OverlayProvider } from '@toss/use-overlay'; | ||
|
||
export default function App({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} />; | ||
return ( | ||
<OverlayProvider> | ||
<Component {...pageProps} />{' '} | ||
</OverlayProvider> | ||
); | ||
} |
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,7 @@ | ||
import ChangePwContent from '@/src/components/resetPwContent/changePwContent'; | ||
|
||
const ChangePassword = () => { | ||
return <ChangePwContent />; | ||
}; | ||
|
||
export default ChangePassword; |
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,7 @@ | ||
import ResetPwContent from '@/src/components/resetPwContent'; | ||
|
||
const ResetPw = () => { | ||
return <ResetPwContent />; | ||
}; | ||
|
||
export default ResetPw; |