Web-1/Gebruikers en sessies/Nodered-cookietest

Uit Inf2019
Naar navigatie springen Naar zoeken springen
De printervriendelijke versie wordt niet langer ondersteund en kan weergavefouten bevatten. Werk uw browserbladwijzers bij en gebruik de gewone afdrukfunctie van de browser.
[{"id":"e1f35fe3.cd261","type":"tab","label":"Cookie test","disabled":false,"info":""},{"id":"e661898c.b51278","type":"http in","z":"e1f35fe3.cd261","name":"","url":"/login","method":"get","upload":false,"swaggerDoc":"","x":140,"y":220,"wires":[["d03f4248.868c3"]]},{"id":"1f65f23c.7813be","type":"http in","z":"e1f35fe3.cd261","name":"","url":"/login-form","method":"post","upload":false,"swaggerDoc":"","x":160,"y":280,"wires":[["d512302e.1810b"]]},{"id":"d03f4248.868c3","type":"template","z":"e1f35fe3.cd261","name":"login-form","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!doctype html>\n<html>\n    <head>\n        <title>Login</title>\n    </head>\n    <body>\n        <h3>Please login</h3>\n        <form method=\"post\" action=\"/login-form\">\n            Name:\n            <input type=\"text\" name=\"username\">\n            <button type=\"submit\">Send</button>\n        </form>\n    </body>\n</html>","output":"str","x":370,"y":220,"wires":[["78f11c39.669974"]]},{"id":"78f11c39.669974","type":"http response","z":"e1f35fe3.cd261","name":"","statusCode":"","headers":{},"x":570,"y":220,"wires":[]},{"id":"fc93f0e5.90ba8","type":"http in","z":"e1f35fe3.cd261","name":"","url":"/cookietest","method":"get","upload":false,"swaggerDoc":"","x":160,"y":340,"wires":[["5bb97fb4.c49cd"]]},{"id":"526cbf84.68e98","type":"template","z":"e1f35fe3.cd261","name":"Test-page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n  <head>\n\t<title>Cookie test</title>\n  </head>\n  <body>\n    <h3>Welcome</h3>\n    <p>Welcome {{user}}!</p>\n    <a href=\"/login\">Change username</a>\n  </body>\n</html>","output":"str","x":580,"y":340,"wires":[["52a3bd8e.6bf184"]]},{"id":"52a3bd8e.6bf184","type":"http response","z":"e1f35fe3.cd261","name":"","statusCode":"","headers":{},"x":750,"y":340,"wires":[]},{"id":"d512302e.1810b","type":"function","z":"e1f35fe3.cd261","name":"process-login-form","func":"var username = msg.payload.username || \"\";\n\nmsg.cookies = {user: username};\nmsg.user = username;\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":280,"wires":[["526cbf84.68e98"]]},{"id":"5bb97fb4.c49cd","type":"function","z":"e1f35fe3.cd261","name":"process-cookietest","func":"msg.user = msg.req.cookies.user || \"\";\nreturn msg;","outputs":1,"noerr":0,"x":390,"y":340,"wires":[["526cbf84.68e98"]]}]