Skip to content

Commit

Permalink
Merge pull request #198 from choiyoubin/test
Browse files Browse the repository at this point in the history
Fix:비밀번호 제약조건 삭제 및 비밀번호찾기 번호 인증시 alert창
  • Loading branch information
choiyoubin authored Mar 26, 2024
2 parents a6603d2 + cab2960 commit 56850b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function CertificationInputPhoneNumber(userInfo) {
if (/^\d+$/.test(phonenumber) && phonenumber.length === 11) {
// 11자리 입력 후에
if (!postmessage) {
alert("인증번호를 발송했습니다. 인증번호가 오지 않으면 입력하신 정보가 회원정보와 일치하는지 확인해 주세요.")
handlePostmessage();
} else { //타이머 초기화용
setPostmessage(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const UserInputPassword = () => {
const handlePasswordChange = (e) => {
const newPassword = e.target.value;
setPassword(newPassword);
isPasswordCombinationValid(newPassword);
// isPasswordCombinationValid(newPassword);
};

const handlePasswordCheckChange = (e) => {
Expand All @@ -25,34 +25,36 @@ const UserInputPassword = () => {
validatePassword(password, newPasswordCheck);
};

const isPasswordLength = (password) => {
const minLength = 8;
return password.length >= minLength;
};
// const isPasswordLength = (password) => {
// const minLength = 8;
// return password.length >= minLength;
// };

const isPasswordCombinationValid = (password) => {
const hasLetter = /[a-zA-Z]/.test(password);
const hasNumber = /\d/.test(password);
const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(password);
return hasLetter && hasNumber && hasSpecialChar;
};
// const isPasswordCombinationValid = (password) => {
// const hasLetter = /[a-zA-Z]/.test(password);
// const hasNumber = /\d/.test(password);
// const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(password);
// return hasLetter && hasNumber && hasSpecialChar;
// };

const validatePassword = (newPassword, newPasswordCheck) => {
if (newPassword !== newPasswordCheck) {
setPasswordError(true);
} else if (!isPasswordLength(newPassword)) {
setPasswordError(true);
} else if (!isPasswordCombinationValid(newPassword)) {
setPasswordError(true);
} else {
// } else if (!isPasswordLength(newPassword)) {
// setPasswordError(true);
// } else if (!isPasswordCombinationValid(newPassword)) {
// setPasswordError(true);
// } else {
setPasswordError(false);
}
};
return(
<div className="signup-page-content-password-wrapper">
<label className="signup-page-content-password-label-style">비밀번호</label>
<div className="signup-page-content-password-label-plus-text">
영문+숫자+특수문자 8자 이상
{/* 영문+숫자+특수문자 8자 이상 */}
비밀번호를 입력해주세요
</div>
<div>
<input
Expand All @@ -79,10 +81,10 @@ const UserInputPassword = () => {
<LoginChkAlrm icon={"X"} paddingSize={"0.45rem"}>
{password !== confirmPassword
? "비밀번호가 일치하지 않습니다."
: !isPasswordLength(password)
? "8자 이상 입력해야 합니다."
: !isPasswordCombinationValid(password)
? "영문+숫자+특수문자의 조합이어야 합니다."
// : !isPasswordLength(password)
// ? "8자 이상 입력해야 합니다."
// : !isPasswordCombinationValid(password)
// ? "영문+숫자+특수문자의 조합이어야 합니다."
: null}
</LoginChkAlrm>
) : <div style={{minHeight: "0.9rem"}}/>
Expand Down

0 comments on commit 56850b8

Please sign in to comment.