Login
The Login widget adds a login button at the top of the dashboard sidebar. The operator picks a role (usuario or admin), types its password and logs in; the button then turns into a logout button. Passwords are checked by Node-RED and never reach the browser. Each successful login and each logout sends a message, so the flow can enable or disable what that role may use.
The node also hides pages from the sidebar menu depending on who is logged in.
Palette: category Renders, label login. No input, 1 output.
Configuration
| Property | Description | Default |
|---|---|---|
| Name | Node name shown in the editor. | "" |
| UI | Dashboard (ui-base) the button is added to. | — (required) |
| usuario | Password of the usuario role. Masked; the eye button shows it. | empty |
| admin | Password of the admin role. Masked; the eye button shows it. | empty |
| Pages shown in the menu | One row per page of the selected dashboard, with a checkbox for logged out, usuario and admin. An unticked page is hidden from the menu in that situation. | Logged out: only the first page is shown. usuario and admin: every page. |
A role with an empty password cannot log in. The passwords are stored as Node-RED credentials, outside the flow file, and are checked by Node-RED.
The pages in the table are the ui-page nodes of the selected dashboard, in their menu order. Until the node is saved with the table, a logged-out visitor sees only the first page.
Output
One message after each successful login and each logout:
{
"topic": "adminAccess",
"enabled": true,
"_client": { "socketId": "Xb3kQ9...", "socketIp": "::ffff:192.0.2.10" }
}| Property | Meaning |
|---|---|
msg.topic | Always adminAccess. |
msg.enabled | true after a correct login, false after a logout. |
msg._client.socketId | Dashboard connection of the browser that logged in or out. |
msg._client.socketIp | Address of that browser's connection, as Node-RED sees it. |
The message does not say which role logged in. A wrong password sends nothing.
Session
- The login lasts for the browser tab: it is kept in the tab's session storage, so a reload keeps it and a new tab starts logged out.
- After 15 minutes without activity (mouse, key presses, scroll or touch) the widget logs out by itself, which sends
enabled: false. One minute before, it shows the notice La sesión expirará en 1 minuto.; any activity restarts the count. After the logout it shows Sesión expirada. - When the menu no longer shows the page that is open (after a login or a logout, or when the dashboard loads), the widget opens the first page the menu still shows.
Status and errors
Texts shown in the login dialog:
| Text | When |
|---|---|
Contraseña incorrecta | Wrong password, or a role with no password configured. |
Demasiados intentos. Espera 30 segundos. | After 5 wrong passwords in a row from the same address, logins from it are refused for 30 seconds. |
The node logs No UI configured and does nothing when no dashboard is selected.
Usage example
Enable the configuration buttons only while someone is logged in: send the output to the widgets that accept msg.enabled, such as Button Confirm or Button Switch.
// function node between ui-login and a ui-btn-confirm
return { enabled: msg.enabled };With the table set so that logged out shows only the production page and admin shows every page, an operator who logs in as admin sees the configuration pages in the menu until they log out or the session expires.