-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy path5-13-2 HTTP 회원등록 Log in 처리 프로그램, Node-RED MongoDB (3).txt
More file actions
1 lines (1 loc) · 12.9 KB
/
5-13-2 HTTP 회원등록 Log in 처리 프로그램, Node-RED MongoDB (3).txt
File metadata and controls
1 lines (1 loc) · 12.9 KB
1
[{"id":"be92f87a.c53688","type":"tab","label":"Log in","disabled":false,"info":""},{"id":"1846d732.d00d29","type":"http in","z":"be92f87a.c53688","name":"","url":"/login","method":"get","upload":false,"swaggerDoc":"","x":219,"y":148,"wires":[["17275bf.765eda4"]]},{"id":"45180d99.60f3b4","type":"http response","z":"be92f87a.c53688","name":"","statusCode":"","headers":{},"x":779,"y":148,"wires":[]},{"id":"cf2833b4.0acb6","type":"comment","z":"be92f87a.c53688","name":"Log in","info":"","x":71,"y":148,"wires":[]},{"id":"e92cc8dc.84f888","type":"comment","z":"be92f87a.c53688","name":"회원가입","info":"","x":81,"y":350,"wires":[]},{"id":"ebdb5506.c28f88","type":"template","z":"be92f87a.c53688","name":"style","field":"payload.style","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"body {font-family: Arial, Helvetica, sans-serif;}\n\n/* Full-width input fields */\ninput[type=text], input[type=password] {\n width: 100%;\n padding: 12px 20px;\n margin: 8px 0;\n display: inline-block;\n border: 1px solid #ccc;\n box-sizing: border-box;\n}\n\n/* Set a style for all buttons */\nbutton {\n background-color: #4CAF50;\n color: white;\n padding: 14px 20px;\n margin: 8px 0;\n border: none;\n cursor: pointer;\n width: 100%;\n}\n\nbutton:hover {\n opacity: 0.8;\n}\n\n/* Extra styles for the cancel button */\n.cancelbtn {\n width: auto;\n padding: 10px 18px;\n background-color: #f44336;\n}\n\n/* Center the image and position the close button */\n.imgcontainer {\n text-align: center;\n margin: 24px 0 12px 0;\n position: relative;\n}\n\nimg.avatar {\n width: 40%;\n border-radius: 50%;\n}\n\n.container {\n padding: 16px;\n}\n\nspan.psw {\n float: right;\n padding-top: 16px;\n}\n\n/* The Modal (background) */\n.modal {\n display: none; /* Hidden by default */\n position: fixed; /* Stay in place */\n z-index: 1; /* Sit on top */\n left: 0;\n top: 0;\n width: 100%; /* Full width */\n height: 100%; /* Full height */\n overflow: auto; /* Enable scroll if needed */\n background-color: rgb(0,0,0); /* Fallback color */\n background-color: rgba(0,0,0,0.4); /* Black w/ opacity */\n padding-top: 60px;\n}\n\n/* Modal Content/Box */\n.modal-content {\n background-color: #fefefe;\n margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */\n border: 1px solid #888;\n width: 80%; /* Could be more or less, depending on screen size */\n}\n\n/* The Close Button (x) */\n.close {\n position: absolute;\n right: 25px;\n top: 0;\n color: #000;\n font-size: 35px;\n font-weight: bold;\n}\n\n.close:hover,\n.close:focus {\n color: red;\n cursor: pointer;\n}\n\n/* Add Zoom Animation */\n.animate {\n -webkit-animation: animatezoom 0.6s;\n animation: animatezoom 0.6s\n}\n\n@-webkit-keyframes animatezoom {\n from {-webkit-transform: scale(0)} \n to {-webkit-transform: scale(1)}\n}\n \n@keyframes animatezoom {\n from {transform: scale(0)} \n to {transform: scale(1)}\n}\n\n/* Change styles for span and cancel button on extra small screens */\n@media screen and (max-width: 300px) {\n span.psw {\n display: block;\n float: none;\n }\n .cancelbtn {\n width: 100%;\n }\n}","x":509,"y":148,"wires":[["2f36fd8c.1019c2"]]},{"id":"17275bf.765eda4","type":"template","z":"be92f87a.c53688","name":"script","field":"payload.script","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"// Get the modal\nvar modal = document.getElementById('id01');\n\n// When the user clicks anywhere outside of the modal, close it\nwindow.onclick = function(event) {\n if (event.target == modal) {\n modal.style.display = \"none\";\n }\n}","output":"str","x":384,"y":148,"wires":[["ebdb5506.c28f88"]]},{"id":"2f36fd8c.1019c2","type":"template","z":"be92f87a.c53688","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n<head>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<style> {{{payload.style}}} </style>\n</head>\n<body>\n<h2>김동일</h2>\n<h2>4차산업혁명의 시작</h2>\n<h2>센서와 엑튜에이터를 크라우드컴퓨터 빅데이터에 연결</h2>\n\n<button onclick=\"document.getElementById('id01').style.display='block'\" style=\"width:auto;\">Login</button>\n<button onclick=\"document.getElementById('id02').style.display='block'\" style=\"width:auto;\">회원가입</button>\n\n<div id=\"id01\" class=\"modal\">\n \n <form class=\"modal-content animate\" action=\"/login_act\" method=\"get\">\n <div class=\"imgcontainer\">\n <span onclick=\"document.getElementById('id01').style.display='none'\" class=\"close\" title=\"Close Modal\">×</span>\n <img src=\"http://c.doowon.ac.kr/image/i2r_big.png\" alt=\"Avatar\" class=\"avatar\">\n </div>\n\n <div class=\"container\">\n <label for=\"email\"><b>email</b></label>\n <input type=\"text\" placeholder=\"Enter Username\" name=\"email\" required>\n <label for=\"pw\"><b>Password</b></label>\n <input type=\"password\" placeholder=\"Enter Password\" name=\"pw\" required>\n <button type=\"submit\">Login</button>\n </div>\n\n <div class=\"container\" style=\"background-color:#f1f1f1\">\n <button type=\"button\" onclick=\"document.getElementById('id01').style.display='none'\" class=\"cancelbtn\">Cancel</button>\n <span class=\"pw\">Forgot <a href=\"#\">password?</a></span>\n </div>\n </form>\n</div>\n\n<div id=\"id02\" class=\"modal\">\n \n <form class=\"modal-content animate\" action=\"/register_act\" method=\"get\">\n <div class=\"imgcontainer\">\n <span onclick=\"document.getElementById('id02').style.display='none'\" class=\"close\" title=\"Close Modal\">×</span>\n <img src=\"http://c.doowon.ac.kr/image/i2r_big.png\" alt=\"Avatar\" class=\"avatar\">\n </div>\n\n <div class=\"container\">\n <label for=\"email\"><b>email</b></label>\n <input type=\"text\" placeholder=\"Enter Username\" name=\"email\" required>\n <button type=\"submit\">회원가입</button>\n 비밀번호는 email로 전송해 드립니다.\n </div>\n\n <div class=\"container\" style=\"background-color:#f1f1f1\">\n <button type=\"button\" onclick=\"document.getElementById('id02').style.display='none'\" class=\"cancelbtn\">Cancel</button>\n </div>\n </form>\n</div>\n\n<script> {{{payload.script}}} </script>\n\n</body>\n</html>","output":"str","x":640,"y":148,"wires":[["45180d99.60f3b4"]]},{"id":"4d8a44f8.ea828c","type":"http in","z":"be92f87a.c53688","name":"","url":"/register_act","method":"get","upload":false,"swaggerDoc":"","x":241,"y":348,"wires":[["8a0f4b39.49e428"]]},{"id":"2db9096d.0ef676","type":"function","z":"be92f87a.c53688","name":"insert one","func":"var email=global.get(\"email\")||\"\";\nvar pw= Math.round(Math.random()*1000000);\nvar newMsg = {};\nnewMsg.collection = 'member';\nnewMsg.operation = 'insert';\nnewMsg.payload = { 'email' : email, 'pw':pw };\nreturn newMsg;","outputs":1,"noerr":0,"x":701,"y":348,"wires":[["42453790.9a34f8","fa4037d.d99cac8"]]},{"id":"3bdfb0d6.e4936","type":"e-mail","z":"be92f87a.c53688","server":"smtp.gmail.com","port":"465","secure":true,"tls":false,"name":"","dname":"","x":1011,"y":408,"wires":[]},{"id":"8a0f4b39.49e428","type":"function","z":"be92f87a.c53688","name":"deleteMany","func":"global.set(\"msg_register_act\",msg);\nglobal.set(\"email\",msg.payload.email);\nvar newMsg = {};\nnewMsg.collection = 'member';\nnewMsg.operation = 'deleteMany';\n//newMsg.operation = 'deleteOne';\nnewMsg.payload = { 'email' : msg.payload.email};\nnewMsg.projection = { 'email' : 1 , '_id' : 0 };\nreturn newMsg;","outputs":1,"noerr":0,"x":411,"y":348,"wires":[["fb84ad6c.cffa4"]]},{"id":"fa4037d.d99cac8","type":"function","z":"be92f87a.c53688","name":"write email","func":"var email=global.get(\"email\")||\"\";\nmsg.to=email;\nmsg.payload=\"임시 비밀번호는 \"+msg.payload.pw+\" 입니다. 로그인 후 변경해 주세요.\";\nmsg.topic=\"임시 비밀번호 from 김동일\";\nreturn msg;","outputs":1,"noerr":0,"x":871,"y":408,"wires":[["3bdfb0d6.e4936"]]},{"id":"42453790.9a34f8","type":"mongodb2 in","z":"be92f87a.c53688","service":"_ext_","configNode":"7c60b83e.73dbc8","name":"등록","collection":"","operation":"","x":851,"y":348,"wires":[["22665b4b.e72a64"]]},{"id":"fb84ad6c.cffa4","type":"mongodb2 in","z":"be92f87a.c53688","service":"_ext_","configNode":"7c60b83e.73dbc8","name":"지우기","collection":"","operation":"","x":553,"y":348,"wires":[["2db9096d.0ef676"]]},{"id":"b4ea1308.b0fed","type":"comment","z":"be92f87a.c53688","name":"","info":"https://myaccount.google.com/lesssecureapps?utm_source=google-account&utm_medium=web\n에서 보안 수준이 낮은 앱의 액세스를 허용","x":1134,"y":408,"wires":[]},{"id":"a3235760.d278f8","type":"http in","z":"be92f87a.c53688","name":"","url":"/login_act","method":"get","upload":false,"swaggerDoc":"","x":238,"y":206,"wires":[["2e777d5.3ccdb82"]]},{"id":"2e777d5.3ccdb82","type":"function","z":"be92f87a.c53688","name":"global","func":"global.set(\"email\",msg.payload.email);\nglobal.set(\"pw\",msg.payload.pw);\nglobal.set(\"msg_login_act\",msg);\nreturn msg;","outputs":1,"noerr":0,"x":391,"y":206,"wires":[["c5711d18.d60f"]]},{"id":"c5711d18.d60f","type":"function","z":"be92f87a.c53688","name":"findOne","func":"var email=global.get(\"email\")||\"\";\nvar newMsg = {};\nnewMsg.collection = 'member';\nnewMsg.operation = 'findOne';\nnewMsg.payload = { 'email' : email};\nnewMsg.projection = { 'email' : 1 , '_id' : 0 };\nreturn newMsg;","outputs":1,"noerr":0,"x":521,"y":206,"wires":[["7bfbb2dc.40dcfc"]]},{"id":"16b07da3.3638a2","type":"switch","z":"be92f87a.c53688","name":"","property":"payload","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"true","repair":false,"outputs":2,"x":794,"y":206,"wires":[["eee7002.1c6fa"],["18cba596.fc8dea"]]},{"id":"18cba596.fc8dea","type":"function","z":"be92f87a.c53688","name":"ID 존재","func":"var pw=global.get(\"pw\")||\"\";\nif(msg.payload.pw==pw) {\n msg.payload=\"로그인 환영합니다.\";\n return [msg,null];\n}\nelse {\n msg.payload=\"pw 일치하지 않습니다. 회원가입 새로 하세요.\";\n return [null,msg];\n} \n","outputs":2,"noerr":0,"x":964,"y":246,"wires":[["e7ac1bab.baf688"],["89191e6d.908ca"]]},{"id":"eee7002.1c6fa","type":"function","z":"be92f87a.c53688","name":"ID 없음","func":"msg.payload=\"ID가 존재하지않습니다. 회원가입을 새로 하세요\";\nreturn msg;","outputs":1,"noerr":0,"x":960,"y":199,"wires":[["89191e6d.908ca"]]},{"id":"7bfbb2dc.40dcfc","type":"mongodb2 in","z":"be92f87a.c53688","service":"_ext_","configNode":"7c60b83e.73dbc8","name":"회원 검색","collection":"","operation":"","x":661,"y":206,"wires":[["16b07da3.3638a2"]]},{"id":"4f1dee4.c35b71","type":"template","z":"be92f87a.c53688","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head>\n <meta name='viewport' content='width=device-width, initial-scale=1.0'/>\n <meta http-equiv='refresh' content='3; url=http://54.244.168.99:1880/login' method='get'> \n </head>\n <body>\n <h1>{{ payload }}</h1>\n </body>\n</html>","x":1294,"y":199,"wires":[["bb644d89.20d81"]]},{"id":"bb644d89.20d81","type":"http response","z":"be92f87a.c53688","name":"Go First Page","statusCode":"","headers":{},"x":1445,"y":199,"wires":[]},{"id":"e7ac1bab.baf688","type":"function","z":"be92f87a.c53688","name":"login 성공","func":"var email=global.get(\"email\")||\"\";\nmsg2=email+\"님 \"+msg.payload;\nvar msg=global.get(\"msg_login_act\")||\"\";\nmsg.payload=msg2;\nmsg.cookies = { \"name\":email };\nreturn msg;","outputs":1,"noerr":0,"x":1124,"y":252,"wires":[["cbde5c03.73c29"]]},{"id":"aca341fe.e129c","type":"comment","z":"be92f87a.c53688","name":"coockies 작성","info":"","x":1131,"y":290,"wires":[]},{"id":"cbde5c03.73c29","type":"template","z":"be92f87a.c53688","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Log in success: {{payload}} !","output":"str","x":1270,"y":252,"wires":[["2cbba42a.df76bc"]]},{"id":"2cbba42a.df76bc","type":"http response","z":"be92f87a.c53688","name":"Go Main Page","statusCode":"","headers":{},"x":1430,"y":252,"wires":[]},{"id":"89191e6d.908ca","type":"function","z":"be92f87a.c53688","name":"ID or PW 없음","func":"var msg1=msg.payload;\nvar msg=global.get(\"msg_login_act\")||\"\";\nmsg.payload=msg1;\nreturn msg;","outputs":1,"noerr":0,"x":1138,"y":199,"wires":[["4f1dee4.c35b71"]]},{"id":"22665b4b.e72a64","type":"template","z":"be92f87a.c53688","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head>\n <meta name='viewport' content='width=device-width, initial-scale=1.0'/>\n <meta http-equiv='refresh' content='0 url=http://54.244.168.99:1880/login' method='get'> \n </head>\n <body>\n <h1>{{ payload }}</h1>\n </body>\n</html>","x":976,"y":348,"wires":[["2f5d553b.079d5a"]]},{"id":"2f5d553b.079d5a","type":"http response","z":"be92f87a.c53688","name":"Go First Page","statusCode":"","headers":{},"x":1127,"y":348,"wires":[]},{"id":"7c60b83e.73dbc8","type":"mongodb2","z":"","uri":"mongodb://localhost:27017/admin","name":"admin","options":"","parallelism":"-1"}]