Heeyeon

Fixing bugs

...@@ -114,7 +114,10 @@ app.get('/logout',(req,res)=>{ ...@@ -114,7 +114,10 @@ app.get('/logout',(req,res)=>{
114 114
115 //로그인 로그아웃 여부 115 //로그인 로그아웃 여부
116 const authInfo = (req)=>{ 116 const authInfo = (req)=>{
117 - if(req.user) return `${user.name} | <a href="/logout">로그아웃</a>`; 117 + if(req.user)
118 + {
119 + return `${user.name} | <a href="/logout">로그아웃</a>`;}
120 + else
118 return `<a href="/login">로그인</a>`; 121 return `<a href="/login">로그인</a>`;
119 } 122 }
120 123
...@@ -154,11 +157,30 @@ function (accessToken, refreshToken, profile, done) { ...@@ -154,11 +157,30 @@ function (accessToken, refreshToken, profile, done) {
154 /*--------------------회원가입 처리---------------------- */ 157 /*--------------------회원가입 처리---------------------- */
155 158
156 159
160 +//회원가입 처리 Post
161 +var user = {};
162 +app.post('/join',(req,res)=>{
163 + user.email = req.body.email;
164 + user.password = req.body.password;
165 + user.name=req.body.name;
166 + //로그인 페이지로 이동
167 + console.log(user);
168 + res.redirect('/login');
169 +});
170 +
171 +
172 +
173 +
174 +
157 //회원가입 페이지 Get 175 //회원가입 페이지 Get
158 app.get('/join',(req,res)=>{ 176 app.get('/join',(req,res)=>{
159 let page = getPage('회원가입',` 177 let page = getPage('회원가입',`
160 <html> 178 <html>
161 <head> 179 <head>
180 + <script> function congratulation()
181 + {
182 + alert("새로운 회원이 되신걸 축하합니다!:D \n 레시피 찾을 준비 되셨나요?");
183 + } </script>
162 <style> 184 <style>
163 body { 185 body {
164 padding-top: 15px; 186 padding-top: 15px;
...@@ -208,10 +230,7 @@ app.get('/join',(req,res)=>{ ...@@ -208,10 +230,7 @@ app.get('/join',(req,res)=>{
208 </style><link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> 230 </style><link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
209 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> 231 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
210 <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> 232 <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
211 - <script> function congratulation() 233 +
212 - {
213 - alert("새로운 회원이 되신걸 축하합니다!:D \n 레시피 찾을 준비 되셨나요?");
214 - } </script>
215 </head> 234 </head>
216 235
217 <body> 236 <body>
...@@ -235,6 +254,7 @@ app.get('/join',(req,res)=>{ ...@@ -235,6 +254,7 @@ app.get('/join',(req,res)=>{
235 </button> 254 </button>
236 </form> 255 </form>
237 </html> 256 </html>
257 +
238 `,'<a href="/login">뒤로가기</a>'); 258 `,'<a href="/login">뒤로가기</a>');
239 res.send(page); 259 res.send(page);
240 }); 260 });
......
1 -{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"flash":{"error":["Missing username or password."]},"__lastAccess":1638446277022}
...\ No newline at end of file ...\ No newline at end of file