-
Notifications
You must be signed in to change notification settings - Fork 0
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 #7 from kimkee/DEV
Dev
- Loading branch information
Showing
8 changed files
with
184 additions
and
18 deletions.
There are no files selected for viewing
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
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,11 @@ | ||
import Nav from '@/app/components/Nav.jsx'; | ||
import Header from '@/app/components/Header.jsx'; | ||
export default function Layout({ children }) { | ||
return ( | ||
<> | ||
<Header /> | ||
{children} | ||
<Nav /> | ||
</> | ||
) | ||
} |
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,124 @@ | ||
"use client" | ||
import Image from 'next/image' | ||
import { useRouter } from 'next/navigation'; | ||
import React, { useState, useEffect, useRef } from 'react'; | ||
import ui from '@/app/ui.js'; | ||
|
||
export default function Login() { | ||
const router = useRouter(); | ||
const [emailRef, passwordRef, nicknameRef, avatarRef] = [useRef(), useRef(), useRef(), useRef()]; | ||
|
||
const erMsg = { | ||
"auth/user-not-found": "존재하지 않는 사용자 정보로 로그인을 시도한 경우 발생", | ||
"auth/wrong-password": "비밀번호가 잘못된 경우 발생", | ||
"auth/too-many-requests": "연속된 로그인 요청이 여러 번 감지되어 로그인 요청이 금지됨", | ||
"auth/weak-password": "비밀번호가 6자리 미만인 경우 발생", | ||
"auth/invalid-email": "잘못된 포맷의 이메일을 입력한 경우 발생", | ||
"auth/email-already-in-use": "이미 사용 중인 이메일 계정 ID로 회원 가입을 시도하는 경우 발생", | ||
"auth/invalid-phone-number": "잘못된 포맷의 핸드폰 번호를 입력한 경우 발생", | ||
"auth/internal-error": "비밀번호를 입력하세요.", | ||
} | ||
const [inpVal, setInpVal] = useState({ | ||
isMail: false, | ||
isPwds: false, | ||
isNick: false, | ||
}); | ||
console.log(inpVal); | ||
const validate = (input) => { | ||
|
||
const pattern = { | ||
mail : /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/, // 이메일 형식 | ||
pass : /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,15}$/, // 문자,숫자 포함6자리 이상 15자 이하 | ||
nick : /^[a-zA-Z0-9가-힣]{1,15}$/ // 특수문자 제외하고 , 문자 또는 숫자 1자리 이상 15자 이하 | ||
} | ||
switch (input.name) { | ||
case 'email': setInpVal( inpVal => ({ ...inpVal, isMail: pattern.mail.test(input.value) })); break; | ||
case 'password': setInpVal( inpVal => ({ ...inpVal, isPwds: pattern.pass.test(input.value) })); break; | ||
case 'nickname': setInpVal( inpVal => ({ ...inpVal, isNick: pattern.nick.test(input.value) })); break; | ||
// case 'nickname': setIsNickValid( pattern.nick.test(input.value) ); break; | ||
default: break; | ||
} | ||
}; | ||
|
||
const member = { | ||
joinReq : async ()=> { | ||
|
||
console.log( document.querySelector( `[name="avatar"]:checked` ).value ); | ||
console.log(emailRef.current.value); | ||
console.log(passwordRef.current.value); | ||
console.log(nicknameRef.current.value); | ||
|
||
ui.loading.show('glx'); | ||
const email = emailRef.current.value; | ||
const password = passwordRef.current.value; | ||
|
||
|
||
}, | ||
addMember : async (user, gourl)=> { | ||
|
||
} | ||
} | ||
|
||
|
||
return ( | ||
<div className="container page sign in"> | ||
<main className={`contents`}> | ||
|
||
<div className="sign-form"> | ||
{/* <div className="hdt">회원가입</div> */} | ||
<div className="join form"> | ||
<div className="tit"><em className="t">회원가입</em></div> | ||
<ul className="list"> | ||
<li> | ||
<label className="dt">아바타</label> | ||
<div className="dd"> | ||
<div className="ut-avata"> | ||
{ ui.avatar.map( (icon,index) => { | ||
return ( | ||
<label key={index}> | ||
<input type="radio" name="avatar" ref={avatarRef} value={index} defaultChecked={index == 0 } /> | ||
<span className="txt"><img className="img" src={icon} alt="" /></span> | ||
</label> | ||
) | ||
}) } | ||
</div> | ||
</div> | ||
</li> | ||
<li> | ||
<label className="dt">이메일</label> | ||
<div className="dd"> | ||
<span className="input"><input ref={emailRef} name="email" type="email" placeholder="예) [email protected]" onInput={(e)=>validate(e.currentTarget)} data-webkit-autofill /></span> | ||
{!inpVal.isMail ? <p className={`msg-valid`}>이메일 형식에 맞게 입력해주세요.</p> : <i className="chk fa-solid fa-check"></i>} | ||
</div> | ||
</li> | ||
<li> | ||
<label className="dt">비밀번호</label> | ||
<div className="dd"> | ||
<span className="input"><input ref={passwordRef} name="password" type="password" placeholder="예) abc123" onInput={(e)=>validate(e.currentTarget)} maxLength={15} /></span> | ||
{!inpVal.isPwds ? <p className={`msg-valid`}>문자,숫자 포함 6자리 이상 입력해주세요.</p> : <i className="chk fa-solid fa-check"></i>} | ||
</div> | ||
</li> | ||
<li> | ||
<label className="dt">닉네임</label> | ||
<div className="dd"> | ||
<span className="input"><input ref={nicknameRef} name="nickname" type="text" placeholder="입력하세요" onInput={(e)=>validate(e.currentTarget)} maxLength={15} /></span> | ||
{!inpVal.isNick ? <p className={`msg-valid`}>특수문자 제외하고 입력해주세요.</p> : <i className="chk fa-solid fa-check"></i>} | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
<div className="btsbox btn-set"> | ||
<button type="button" className="btn" | ||
disabled={!(inpVal.isMail && inpVal.isPwds && inpVal.isNick)} | ||
onClick={member.joinReq}><i className="fa-solid fa-right-to-bracket"></i><em>회원가입</em></button> | ||
</div> | ||
<div className="link"> | ||
이미 회원이신가요? <button type="button" className="bt" onClick={ ()=> router.push(`/user/login`) }>로그인 하러가기 <i className="fa-solid fa-chevron-right"></i></button> | ||
</div> | ||
|
||
</div> | ||
|
||
</main> | ||
</div> | ||
) | ||
}; |
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,10 +1,11 @@ | ||
"use client" | ||
import Image from 'next/image' | ||
import { useRouter } from 'next/navigation'; | ||
import React, { useRef } from 'react'; | ||
import ui from '@/app/ui.js'; | ||
|
||
export default function Login() { | ||
|
||
const router = useRouter(); | ||
const userEmail = useRef(null); | ||
const userPassword = useRef(null); | ||
const autoLogin = useRef(null); | ||
|
@@ -48,26 +49,26 @@ export default function Login() { | |
<div className="sns form"> | ||
<div className="tit"><em className="t">SNS 로그인</em></div> | ||
<div className="bts"> | ||
<button type="button" className="btn" /* onClick={''} */><i className="fa-brands fa-google"></i><em>Google </em></button> | ||
<button type="button" className="btn" onClick={loginGithub }><i className="fa-brands fa-github"></i><em>Github </em></button> | ||
<button type="button" className="btn" /* onClick={''} */><i className="fa-brands fa-facebook"></i><em>Facebook </em></button> | ||
<button type="button" className="btn" /* onClick={''} */><i className="fa-brands fa-twitter"></i><em>Twitter </em></button> | ||
<button type="button" className="btn" onClick={loginGithub }><i className="fa-brands fa-github" /><em>Github </em></button> | ||
<button type="button" className="btn" disabled><i className="fa-brands fa-google" /><em>Google </em></button> | ||
<button type="button" className="btn" disabled><i className="fa-brands fa-kickstarter-k" /><em>Kakao </em></button> | ||
<button type="button" className="btn" disabled><i className="fa-brands fa-twitter" /><em>Twitter </em></button> | ||
</div> | ||
</div> | ||
<div className="eml form"> | ||
<div className="tit"><em className="t">Email 계정 로그인</em></div> | ||
<ul className="list"> | ||
<li> | ||
<div className="dd"><span className="input"><input type="email" ref={userEmail} placeholder="이메일 ([email protected])" /></span></div> | ||
<div className="dd"><span className="input"><input type="email" ref={userEmail} placeholder="이메일" /></span></div> | ||
</li> | ||
<li> | ||
<div className="dd"><span className="input"><input type="password" ref={userPassword} placeholder="비밀번호 (123456)" /></span></div> | ||
<div className="dd"><span className="input"><input type="password" ref={userPassword} placeholder="비밀번호" /></span></div> | ||
</li> | ||
</ul> | ||
<div className="savelogin"> | ||
<a className={`bt`} to={"/user/signup"}> | ||
<button type="button" className={`bt`} onClick={ ()=> router.push(`/user/join`) }> | ||
회원가입하러 가기 <i className="fa-solid fa-chevron-right"></i> | ||
</a> | ||
</button> | ||
<label className="checkbox"><input type="checkbox" ref={autoLogin} onChange={saveSheck} /><span className="txt">자동 로그인</span></label> | ||
</div> | ||
<div className="btsbox btn-set"><button type="button" className="btn" onClick={login}><i className="fa-solid fa-right-to-bracket"></i><em>로그인</em></button></div> | ||
|