Allow the user to change his/her password for dashboard UI

I would store that data in a JSON file alongside your settings.js and include it with require. You can easily generate valid JSON strings using the json node or JSON.stringify() from within a function node.

In your settings.js file, using a try/catch around it would be wise, so you can handle errors like invalid format or missing file. Use default values in that case, so Node-RED can start properly.

You'd have to restart your Node-RED process, of course.

Oh, and don't forget to create the proper password hash like the node-red-admin hash-pw command line tool does.
Here's a pointer: https://github.com/node-red/node-red-admin/blob/master/lib/commands/hash.js

1 Like