an attempt to create a password authentication subflow. Inspired by several posts in this forum.
feedback and suggestions required to improve.
gives output msg.auth
as boolean true
or boolean false
also shows the result in notification on browser
PS: password is password
[{"id":"215bd10b8e5bb52e","type":"subflow","name":"Password","info":"","category":"","in":[{"x":110,"y":210,"wires":[{"id":"99cc850a1d0922be"}]}],"out":[{"x":910,"y":190,"wires":[{"id":"fc8e1e11e9e11e6a","port":0},{"id":"3e6ee77098e8b163","port":0}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"19cb3fa7a24b617f","type":"ui_toast","z":"215bd10b8e5bb52e","position":"prompt","displayTime":"3","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"Cancel","raw":true,"className":"","topic":"","name":"Ask Password","x":420,"y":210,"wires":[["823e9dc589a4ae6a"]]},{"id":"823e9dc589a4ae6a","type":"switch","z":"215bd10b8e5bb52e","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"password","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":210,"wires":[["fc8e1e11e9e11e6a"],["3e6ee77098e8b163"]]},{"id":"ea6bc392d093238b","type":"ui_toast","z":"215bd10b8e5bb52e","position":"dialog","displayTime":"3","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"Incorrect Password","x":960,"y":250,"wires":[[]]},{"id":"3e6ee77098e8b163","type":"change","z":"215bd10b8e5bb52e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Authentication Failed!","tot":"str"},{"t":"set","p":"auth","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":250,"wires":[["ea6bc392d093238b"]]},{"id":"99cc850a1d0922be","type":"function","z":"215bd10b8e5bb52e","name":"Content","func":"return { payload: '<style>input{ -webkit-text-security: disc;}</style>Please enter your password'};","outputs":1,"noerr":0,"x":240,"y":210,"wires":[["19cb3fa7a24b617f"]]},{"id":"fc8e1e11e9e11e6a","type":"change","z":"215bd10b8e5bb52e","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"Authentication Successful!","tot":"str"},{"t":"set","p":"auth","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":130,"wires":[["076bc748a119ecaf"]]},{"id":"076bc748a119ecaf","type":"ui_toast","z":"215bd10b8e5bb52e","position":"dialog","displayTime":"2","highlight":"green","sendall":false,"outputs":1,"ok":"OK","cancel":"","raw":false,"className":"","topic":"","name":"Password OK","x":940,"y":130,"wires":[[]]},{"id":"f894a1be8b5bafb6","type":"subflow:215bd10b8e5bb52e","z":"d12f70e7abaacb43","name":"","x":970,"y":150,"wires":[["86aa2a0467eae814","874c04f877e552e8"]],"icon":"font-awesome/fa-eye"},{"id":"5d41dae9debf4c0a","type":"inject","z":"d12f70e7abaacb43","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":820,"y":150,"wires":[["f894a1be8b5bafb6"]]},{"id":"86aa2a0467eae814","type":"debug","z":"d12f70e7abaacb43","name":"Authentication Status","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1170,"y":110,"wires":[]},{"id":"874c04f877e552e8","type":"debug","z":"d12f70e7abaacb43","name":"Authentication","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"auth","targetType":"msg","statusVal":"payload","statusType":"auto","x":1160,"y":180,"wires":[]}]