Skip to content

Commit

Permalink
refactor(FE) : 회원가입 페이지 비밀번호 체크 수정 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjh96 committed Feb 10, 2023
1 parent ff31e88 commit 1dfa238
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions client/src/components/auth/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ const register = () => {
.replace(/(\-{1,2})$/g, '');
};

const checkPassword = (target) => {
if (userData.password !== userData.passwordCheck) return target.classList.add('invalid');
target.classList.remove('invalid');
};

const testValidation = ({ target }, type, reg) => {
if (target.type === 'tel') return putAutoHyphen(target);
if (type === 'passwordCheck') return checkPassword(target);
const isValidate = reg.test(target.value);

changeButtonStatus(type, isValidate);
Expand Down Expand Up @@ -135,6 +141,12 @@ const register = () => {
$.find('#phone-input'),
$.on('input', (e) => testValidation(e, '.phone', emailReg)))(target);

// prettier-ignore
const validatePassword = (target) =>
_.pipe(
$.find('#password-check-input'),
$.on('input', (e) => testValidation(e, 'passwordCheck', codeReg)))(target);

// prettier-ignore
const sendVerificationCode = () =>
new Promise((resolve) =>
Expand Down Expand Up @@ -178,6 +190,7 @@ const register = () => {
handleClickEye,
validateEmail,
validatePhone,
validatePassword,
sendVerificationCode(),
validateCode,
submitData);
Expand Down
2 changes: 1 addition & 1 deletion client/src/constants/constant.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const SERVER_URL = {
IMG: 'https://amatta-icons.s3.ap-northeast-2.amazonaws.com/',
API: 'http://backend.amatta.site/',
API: 'https://backend.amatta.site/',
};

const EMAIL_REG = '^[a-zA-Z0-9+-_.]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$';
Expand Down
7 changes: 7 additions & 0 deletions client/src/styles/auth.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@
}
}

.invalid {
border-bottom: 1px solid $red-color !important;
+ label {
color: $red-color !important;
}
}

.confirm-button,
.verify-button {
position: absolute;
Expand Down

0 comments on commit 1dfa238

Please sign in to comment.