-
Notifications
You must be signed in to change notification settings - Fork 43
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
[박나겸] Spritn4 #179
The head ref may contain hidden characters: "Basic-\uBC15\uB098\uACB8-sprint4"
[박나겸] Spritn4 #179
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const passwordInput= document.getElementById('password'); | ||
|
||
function onEyecliked(){ | ||
if(passwordInput.type === 'password'){ | ||
passwordInput.type='text'; | ||
}else{ | ||
passwordInput.type='password'; | ||
} | ||
} | ||
|
||
function emailChange(){ | ||
const emailInput = document.getElementById('email'); | ||
const emailError = document.getElementById('emailError'); | ||
const submitBtn=document.querySelector('.button'); | ||
const email=emailInput.value; | ||
|
||
if(email.includes("@")&&email.includes(".")){ | ||
emailInput.classList.remove('error'); | ||
emailError.innerText = ''; // 에러 메시지 제거 | ||
emailError.classList.remove('error_msg'); | ||
submitBtn.disabled = false; | ||
submitBtn.style.backgroundColor = 'var(--blue100)'; // 원 | ||
|
||
}else if(!email){ | ||
emailError.innerText='이메일을 입력해주세요' | ||
emailInput.classList.add('error'); | ||
emailError.classList.add('error_msg'); | ||
submitBtn.disabled=true; | ||
}else{ | ||
emailError.innerText='유효한 이메일 형식이 아닙니다.' | ||
emailInput.classList.add('error'); | ||
submitBtn.disabled=true; | ||
} | ||
|
||
} | ||
|
||
|
||
function passwordChange(){ | ||
const pwInput = document.getElementById('password'); | ||
const pwError = document.getElementById('passwordError'); | ||
const submitBtn=document.querySelector('.button'); | ||
const password=pwInput.value; | ||
|
||
if(!password){ | ||
pwError.innerText='비밀번호를 입력해주세요' | ||
pwInput.classList.add('error'); | ||
pwError.classList.add('error_msg'); | ||
submitBtn.disabled=true; | ||
} | ||
else if(password.length<=8){ | ||
pwError.innerText='비밀번호를 8자 이상 입력해주세요'; | ||
pwInput.classList.add('error'); | ||
pwError.classList.add('error_msg'); | ||
submitBtn.disabled=true; | ||
} | ||
else{ | ||
pwInput.classList.remove('error'); | ||
pwError.innerText = ''; // 에러 메시지 제거 | ||
pwError.classList.remove('error_msg'); | ||
submitBtn.disabled = false; | ||
submitBtn.style.backgroundColor = 'var(--blue100)'; // 원 | ||
|
||
} | ||
Comment on lines
+44
to
+63
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 꼼꼼하게 예외처리 잘 처리하신것같아요ㅎㅎ! |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function nicknameChange(){ | ||
const nickname=document.getElementById('nickname'); | ||
const nameError=document.getElementById('nicknameError'); | ||
const name=nickname.value; | ||
|
||
if(!name){ | ||
nickname.classList.add('error'); | ||
nameError.innerText='닉네임을 입력해주세요.'; | ||
submitBtn.disabled=true; | ||
}else{ | ||
nickname.classList.remove('error'); | ||
nameError.innerText=''; | ||
submitBtn.disabled = false; | ||
submitBtn.style.backgroundColor = 'var(--blue100)'; // 원 | ||
|
||
} | ||
|
||
} | ||
|
||
function passwordConfirm(){ | ||
const password=document.getElementById('password').value; | ||
const confirmPw=document.getElementById('confirm_password'); | ||
const confirmPassword=confirmPw.value; | ||
const confirmPasswordError=document.getElementById('confirm_password_Error'); | ||
|
||
if(password !== confirmPassword){ | ||
confirmPasswordError.innerText='비밀번호가 일치하지 않습니다' | ||
confirmPw.classList.add('error'); | ||
submitBtn.disabled=true; | ||
} else{ | ||
confirmPw.classList.remove('error'); | ||
confirmPasswordError.innerText=''; | ||
submitBtn.disabled = false; | ||
submitBtn.style.backgroundColor = 'var(--blue100)'; // 원 | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ | |
<link href="../styles/auth_style.css" rel="stylesheet" type="text/css"> | ||
<title>판다마켓</title> | ||
</head> | ||
<body class="body_divider"> | ||
<div class="divider"></div> | ||
<body> | ||
<div class="auth_box"> | ||
<div class="auth_logo"> | ||
<a href="/index.html"> | ||
|
@@ -20,20 +19,25 @@ | |
<form class="auth_contents"> | ||
<div class="auth_content"> | ||
<label>이메일</label> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <label for="email">이메일</label> 이렇게 바꾸면 로그인을 클릭하더라도 email input에 포커스가 갈꺼에요ㅎㅎ! |
||
<input class="info" type="text" name="name" placeholder="이메일을 입력해주세요"> | ||
<input id="email" class="info" type="text" name="name" placeholder="이메일을 입력해주세요" onblur="emailChange()"> | ||
<div id="emailError"></div> | ||
</div> | ||
<div class="auth_content pw"> | ||
<label>비밀번호</label> | ||
<div class="auth_content"> | ||
<label for="password">비밀번호</label> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아아 알고계신데 위에 이메일은 누락되신거군요ㅎㅎ 이미 알고계시다면 그냥 넘어가도 괜찮아요~!! |
||
<div class="info_pw"> | ||
<input class="info" type="password" name="password" placeholder="비밀번호를 입력해주세요"> | ||
<div class="eye"> | ||
<img src="/images/btn_visibility_on_24px.svg"> | ||
<input id="password" class="info" type="password" name="password" placeholder="비밀번호를 입력해주세요" onblur="passwordChange()"> | ||
<div class="eye" onclick="onEyecliked()"> | ||
<img id="eye_img" onclick="onImgcliked()" src="/images/btn_visibility_on_24px.svg"> | ||
</div> | ||
<div id="passwordError"></div> | ||
<span></span> | ||
</div> | ||
</div> | ||
<div> | ||
<input class="button" type="submit" value="로그인"> | ||
<input class="button" type="button" value="로그인" onclick="location.href='/pages/items.html';"> | ||
Comment on lines
-35
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아직 form을 안배워서 submit 버튼이 되면 action이 발생되어서 원하는대로 동작이 안되시긴 할꺼에요...! 원래대로 submit이 맞고, form 태그로 감싸주는게 원래는맞아요ㅎㅎ;; 일단 이부분은 배우기 전이니 넘어가도 괜찮습니다! |
||
</div> | ||
<!-- 여기서 type을 submit에서 button으로 바꾸면 나중에 서버와 연동 할때 안되지 않나요,.. | ||
그러면 ,, --> | ||
</form> | ||
|
||
<div class="at_easy"> | ||
|
@@ -53,8 +57,7 @@ | |
</a> | ||
</div> | ||
</div> | ||
<div class="divider"></div> | ||
|
||
<script src="/js/login_js.js"></script> | ||
</body> | ||
<script src="/js/javascript.js"></script> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,32 +20,36 @@ | |
<form class="auth_contents"> | ||
<div class="auth_content"> | ||
<label>이메일</label> | ||
<input class="info" type="text" name="name" placeholder="이메일을 입력해주세요"> | ||
<input id="email" class="info" type="text" name="name" placeholder="이메일을 입력해주세요" onblur="emailChange()"> | ||
<div id="emailError"></div> | ||
</div> | ||
<div class="auth_content"> | ||
<label>닉네임</label> | ||
<input class="info" type="text" name="name" placeholder="닉네임을 입력해주세요"> | ||
<input id='nickname' class="info" type="text" name="name" placeholder="닉네임을 입력해주세요" onblur="nicknameChange()"> | ||
</div> | ||
<div class="auth_content"> | ||
<label>비밀번호</label> | ||
<label for="password">비밀번호</label> | ||
<div class="info_pw"> | ||
<input class="info" type="password" name="password" placeholder="비밀번호를 입력해주세요"> | ||
<div class="eye"> | ||
<img src="/images/btn_visibility_on_24px.svg"> | ||
<input id="password" class="info" type="password" name="password" placeholder="비밀번호를 입력해주세요" onblur="passwordChange()"> | ||
<div class="eye" onclick="onEyecliked()"> | ||
<img id="eye_img" onclick="onImgcliked()" src="/images/btn_visibility_on_24px.svg"> | ||
Comment on lines
+34
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 클릭했을때 onImgcliked 도 있고 onEyecliked 가 있는데 어떤게 맞는걸까요? |
||
</div> | ||
<div id="passwordError"></div> | ||
</div> | ||
</div> | ||
<div class="auth_content"> | ||
<label>비밀번호 확인</label> | ||
<div class="info_pw"> | ||
<input class="info" type="password" name="password" placeholder="비밀번호를 다시 한 번 입력해주세요"> | ||
<div class="eye"> | ||
<input id="confirm_password" class="info" type="password" name="confirm_password" placeholder="비밀번호를 다시 한 번 입력해주세요" onblur="passwordConfirm()"> | ||
<div class="eye" onclick="onEyecliked()"> | ||
<img src="/images/btn_visibility_on_24px.svg"> | ||
</div> | ||
Comment on lines
+44
to
46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아래쪽꺼 눈 아이콘을 클릭해도 위에있는 비밀번호 input의 type이 바뀌는것같아요ㅠ 이 버그를 해겨결하기 위해선 비밀번호 확인에도 별도의 함수를 만들어주어야 겠네요...!ㅠ 근데 그렇게 하자니 너무 코드가 길어지고 중복되는 코드가 많아져서 보기 싫으실 수 있어요...ㅠㅠㅠ js도 모듈화를 할 수 있는데, 그건 멘토링때 같이 해보구요, 일단 회원가입 페이지에서 비밀번호확인쪽도 정상적으로 동작하도록 수정해보면 좋을것같아요! 제일 쉽게는 그냥 passwordConfirm을 위한 함수를 따로 만들어주면 되겠죠ㅎㅎ! |
||
<div id="confirm_password_Error"></div> | ||
</div> | ||
<span></span> | ||
</div> | ||
<div> | ||
<input class="button" type="submit" value="회원가입"> | ||
<input class="button" type="button" value="회원가입" onclick="location.href='/pages/login.html';"> | ||
</div> | ||
</form> | ||
|
||
|
@@ -66,7 +70,7 @@ | |
</div> | ||
|
||
</div> | ||
|
||
<script src="/js/login_js.js"></script> | ||
<script src="/js/signup_js.js"></script> | ||
</body> | ||
<script src="/js/javascript.js"></script> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분을 조금 개선하면 좋을것같아요!
일단 이메일인지 아닌지 구분하기 위해서
@
랑.
이 포함되긴 해야겠지만 다른 조건들도 여러가지가 있을꺼에요...ㅠ그걸 하나하나 if문으로 거르는건 어렵고, 이런 문제를 해결하기 위해서 실무에서 정규표현식 이라는걸 많이 사용해요!
문자열의 패턴을 검사하는건데, 다음과 같이 사용해요
형태는 조금 어려울 수있는데, 우선 이런게 있다 정도만 알고 넘어가도 좋아요ㅎㅎ