-
Notifications
You must be signed in to change notification settings - Fork 39
[맹은빈]Sprint4 #146
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
The head ref may contain hidden characters: "Basic-\uB9F9\uC740\uBE48-sprint4"
[맹은빈]Sprint4 #146
Changes from all commits
6164c0b
26a0490
e935a30
74237f4
977643c
76c748f
1c871fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ | |
| <link rel="stylesheet" href="/login.css" /> | ||
| </head> | ||
| <body> | ||
|
|
||
| <div class="container"> | ||
| <div class="content-box"> | ||
| <div class="header-logo"> | ||
|
|
@@ -29,6 +28,7 @@ | |
| class="input-box" | ||
| placeholder="이메일을 입력해주세요" | ||
| /> | ||
| <div id="emailErrDiv" class="errDiv"></div> | ||
| </div> | ||
|
|
||
| <div class="input-box-container"> | ||
|
|
@@ -41,17 +41,19 @@ | |
| class="input-box" | ||
| placeholder="비밀번호를 입력해주세요" | ||
| /> | ||
|
|
||
| <img | ||
| class="passwordIcon" | ||
| src="/images/icons/eyesIcon.png" | ||
| alt="비밀번호아이콘" | ||
| /> | ||
| </div> | ||
| <div id="passwordErrDiv" class="errDiv"></div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="button-container"> | ||
| <button class="login-button">로그인</button> | ||
| <button id="loginButton" class="login-button">로그인</button> | ||
| </div> | ||
|
|
||
| <div class="simple-login-box"> | ||
|
|
@@ -77,5 +79,8 @@ | |
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <script src="/scripts/loginValidate.js"></script> | ||
| <script src="/scripts/passwordIcon.js"></script> | ||
|
Comment on lines
+83
to
+84
Collaborator
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. 💊 제안 아마 script 태그를 HTML의 하단에 배치하신 이유가 script가 문서의 렌더링을 막지 않도록 하기 위해서이실 것 같아요. 지금과 같은 경우 DOM을 조작하는 JS 이니 defer 속성을 추가하시면 되겠습니다~ |
||
| </body> | ||
| </html> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| const email = document.getElementById('email'); | ||
| const emailError = document.getElementById('emailErrDiv'); | ||
| const password = document.getElementById('password'); | ||
| const passwordError = document.getElementById('passwordErrDiv'); | ||
| const loginButton = document.getElementById('loginButton'); | ||
|
|
||
| let emailCheck = false; | ||
| let passwordCheck = false; | ||
| let isLoginPossible = false; | ||
|
|
||
| function validateEmail() { | ||
| const emailValue = email.value.trim(); | ||
| const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | ||
|
|
||
| if (emailValue === '') { | ||
| emailError.textContent = '이메일을 입력하세요.'; | ||
| email.classList.add('invalid'); | ||
| emailCheck = false; | ||
| } else if (!emailPattern.test(emailValue)) { | ||
| emailError.textContent = '잘못된 이메일 형식입니다.'; | ||
| email.classList.add('invalid'); | ||
| emailCheck = false; | ||
| } else { | ||
| emailError.textContent = ''; | ||
| email.classList.remove('invalid'); | ||
| emailCheck = true; | ||
| } | ||
|
|
||
| LoginCheck(); | ||
| } | ||
|
|
||
| function validatePassword() { | ||
| const passwordValue = password.value.trim(); | ||
|
|
||
| if (passwordValue === '') { | ||
| passwordError.textContent = '비밀번호를 입력해주세요.'; | ||
| password.classList.add('invalid'); | ||
| passwordCheck = false; | ||
| } else if (passwordValue.length < 8) { | ||
| passwordError.textContent = '비밀번호를 8자이상 입력해주세요.'; | ||
| password.classList.add('invalid'); | ||
| passwordCheck = false; | ||
| } else { | ||
| passwordError.textContent = ''; | ||
| password.classList.remove('invalid'); | ||
| passwordCheck = true; | ||
| } | ||
|
|
||
| LoginCheck(); | ||
| } | ||
|
|
||
| function LoginCheck() { | ||
| if (emailCheck && passwordCheck) { | ||
| isLoginPossible = true; | ||
| loginButton.classList.add('activate'); | ||
| } else { | ||
| loginButton.classList.remove('activate'); | ||
| isLoginPossible = false; | ||
| } | ||
| } | ||
|
|
||
| function Login() { | ||
| if (isLoginPossible) { | ||
| location.href = '/pages/items.html'; | ||
| } else { | ||
| window.alert('올바른 이메일/비밀번호를 입력해주세요.'); | ||
| } | ||
| } | ||
|
|
||
| email.addEventListener('blur', validateEmail); | ||
| password.addEventListener('blur', validatePassword); | ||
| loginButton.addEventListener('click', Login); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| const toggleIcons = document.querySelectorAll('.passwordIcon'); | ||
|
|
||
| toggleIcons.forEach((icon) => { | ||
| icon.addEventListener('click', function () { | ||
| const passwordInput = this.parentElement.querySelector('input'); | ||
|
|
||
| if (passwordInput.type === 'password') { | ||
| passwordInput.type = 'text'; | ||
| this.src = '/images/icons/eyeOpen.png'; | ||
| } else { | ||
| passwordInput.type = 'password'; | ||
| this.src = '/images/icons/eyesIcon.png'; | ||
| } | ||
| }); | ||
| }); |
|
Collaborator
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,116 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const email = document.getElementById('email'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
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. 💊 제안 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const emailError = document.getElementById('emailErrDiv'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const nickname = document.getElementById('name'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const nicknameError = document.getElementById('nicknameErrDiv'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const password = document.getElementById('password'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const passwordError = document.getElementById('passwordErrDiv'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const confirmPassword = document.getElementById('confirmPassword'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const confirmError = document.getElementById('confirmErrDiv'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const signupButton = document.getElementById('signupButton'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let emailCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
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. ❗️ 수정요청 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let nicknameCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let passwordCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let confirmPasswordCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let isSignUpPossible = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function validateEmail() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const emailValue = email.value.trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
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. 💊 제안 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (emailValue === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emailError.textContent = '이메일을 입력하세요.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| email.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emailCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (!emailPattern.test(emailValue)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emailError.textContent = '잘못된 이메일 형식입니다.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| email.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emailCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emailError.textContent = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| email.classList.remove('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| emailCheck = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signUpCheck(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function validateNickname() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const nicknameValue = nickname.value.trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (nicknameValue === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nicknameError.textContent = '닉네임을 입력해주세요.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nickname.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nicknameCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nicknameError.textContent = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nicknameError.classList.remove('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nicknameCheck = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signUpCheck(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function validatePassword() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const passwordValue = password.value.trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (passwordValue === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| passwordError.textContent = '비밀번호를 입력해주세요.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| password.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| passwordCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (passwordValue.length < 8) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| passwordError.textContent = '비밀번호를 8자이상 입력해주세요.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| password.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| passwordCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| passwordError.textContent = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| password.classList.remove('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| passwordCheck = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signUpCheck(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function validateConfirmPassword() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const confirmValue = confirmPassword.value.trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const passwordValue = password.value.trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (confirmValue === '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmError.textContent = '비밀번호를 입력해주세요.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPassword.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPasswordCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (confirmValue !== passwordValue) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmError.textContent = '비밀번호가 일치하지 않습니다.'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPassword.classList.add('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPasswordCheck = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmError.textContent = ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPassword.classList.remove('invalid'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPasswordCheck = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+75
to
+89
Collaborator
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. ❗️ 수정요청
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signUpCheck(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function signUpCheck() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (emailCheck && nicknameCheck && passwordCheck && confirmPasswordCheck) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isSignUpPossible = true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signupButton.classList.add('activate'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signupButton.classList.remove('active'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| isSignUpPossible = false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+94
to
+102
Collaborator
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. 💬 여담
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function SignUp() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
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. 💊 제안 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isSignUpPossible) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| location.href = '/pages/login.html'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| window.alert('올바른 정보들을 입력해주세요'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| email.addEventListener('blur', validateEmail); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| nickname.addEventListener('blur', validateNickname); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| password.addEventListener('blur', validatePassword); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| confirmPassword.addEventListener('blur', validateConfirmPassword); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| signupButton.addEventListener('click', SignUp); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
💊 제안
클래스명에 태그명이 들어갈 필요가 없어보여요~
또한 클래스명 규칙도 하나로 통일해주시는 것을 추천드려요!
emailErrorDiv는 카멜케이스 방식, email-error-div는 케밥케이스 방식인데 지금의 경우 혼용되고 있으니 하나로 통일해주세요~
추가로 아이디와 클래스명의 규칙을 구분하시는 것은 괜찮습니다~