Showing
4 changed files
with
17 additions
and
8 deletions
... | @@ -64,11 +64,13 @@ passport.use(new LocalStrategy({ | ... | @@ -64,11 +64,13 @@ passport.use(new LocalStrategy({ |
64 | console.log(user); | 64 | console.log(user); |
65 | 65 | ||
66 | //아이디가 다를때 | 66 | //아이디가 다를때 |
67 | - if (id !== user.email) | 67 | + if (id !== user.email){ |
68 | - return done(null, false, { message: '아이디가 다르다' }); | 68 | + //alert("존재하는 아이디가 없습니다.") |
69 | + return done(null, false, { message: '아이디가 다르다' });} | ||
69 | //비밀번호가 다를때 | 70 | //비밀번호가 다를때 |
70 | - else if (password !== user.password) | 71 | + else if (password !== user.password) { |
71 | - return done(null, false, { message: '비번이 다르다' }); | 72 | + //alert("비밀번호가 다릅니다."); |
73 | + return done(null, false, { message: '비번이 다르다' });} | ||
72 | //아이디, 비밀번호 모두 맞을 경우 | 74 | //아이디, 비밀번호 모두 맞을 경우 |
73 | return done(null, user); | 75 | return done(null, user); |
74 | } | 76 | } |
... | @@ -87,11 +89,15 @@ passport.authenticate('local', { | ... | @@ -87,11 +89,15 @@ passport.authenticate('local', { |
87 | //회원가입 페이지 Get | 89 | //회원가입 페이지 Get |
88 | app.get('/join',(req,res)=>{ | 90 | app.get('/join',(req,res)=>{ |
89 | let page = getPage('회원가입',` | 91 | let page = getPage('회원가입',` |
92 | + <script> function congratulation() | ||
93 | + { | ||
94 | + alert("새로운 회원이 되신걸 축하합니다!:D \n 레시피 찾을 준비 되셨나요?"); | ||
95 | + } </script> | ||
90 | <form action="/join" method="post"> | 96 | <form action="/join" method="post"> |
91 | <input type="email" name="email" placeholder="email"><br> | 97 | <input type="email" name="email" placeholder="email"><br> |
92 | <input type="password" name="password" placeholder="****"><br> | 98 | <input type="password" name="password" placeholder="****"><br> |
93 | <input type="name" name="name" placeholder="이름"><br> | 99 | <input type="name" name="name" placeholder="이름"><br> |
94 | - <input type="submit" value="회원가입"><br> | 100 | + <input type="submit" value="회원가입" onClick="javascript:congratulation()"><br> |
95 | </form> | 101 | </form> |
96 | `,'<a href="/login">뒤로가기</a>'); | 102 | `,'<a href="/login">뒤로가기</a>'); |
97 | res.send(page); | 103 | res.send(page); |
... | @@ -109,6 +115,7 @@ app.post('/join',(req,res)=>{ | ... | @@ -109,6 +115,7 @@ app.post('/join',(req,res)=>{ |
109 | 115 | ||
110 | //로그 아웃 처리 | 116 | //로그 아웃 처리 |
111 | app.get('/logout',(req,res)=>{ | 117 | app.get('/logout',(req,res)=>{ |
118 | + | ||
112 | //passport 정보 삭제 | 119 | //passport 정보 삭제 |
113 | req.logout(); | 120 | req.logout(); |
114 | //서버측 세션 삭제 | 121 | //서버측 세션 삭제 |
... | @@ -127,7 +134,7 @@ app.listen(3000,()=>console.log(`http://localhost:3000`)); | ... | @@ -127,7 +134,7 @@ app.listen(3000,()=>console.log(`http://localhost:3000`)); |
127 | //로그인 로그아웃 여부 | 134 | //로그인 로그아웃 여부 |
128 | const authInfo = (req)=>{ | 135 | const authInfo = (req)=>{ |
129 | if(req.user) return `${user.name} | <a href="/logout">로그아웃</a>`; | 136 | if(req.user) return `${user.name} | <a href="/logout">로그아웃</a>`; |
130 | - return `<a href="/login">login</a>`; | 137 | + return `<a href="/login">로그인</a>`; |
131 | } | 138 | } |
132 | 139 | ||
133 | //페이지 템플릿 | 140 | //페이지 템플릿 | ... | ... |
... | @@ -7,6 +7,10 @@ searchForm.addEventListener('submit', function(event){ | ... | @@ -7,6 +7,10 @@ searchForm.addEventListener('submit', function(event){ |
7 | alert('한글자 이상 입력해주세요'); | 7 | alert('한글자 이상 입력해주세요'); |
8 | event.preventDefault(); | 8 | event.preventDefault(); |
9 | } | 9 | } |
10 | + else if(document.getElementById('name').value.length >= 10){ | ||
11 | + alert('검색어가 너무 깁니다'); | ||
12 | + event.preventDefault(); | ||
13 | + } | ||
10 | else{ | 14 | else{ |
11 | event.preventDefault(); | 15 | event.preventDefault(); |
12 | searchQuery = event.target.querySelector('input').value; | 16 | searchQuery = event.target.querySelector('input').value; | ... | ... |
1 | -{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"passport":{"user":"rndus0819@naver.com"},"__lastAccess":1637855607507} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"passport":{"user":"rndus0819@naver.com"},"__lastAccess":1637929837064} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment