Dropdown + password popup

I am trying to accomplish the following task: I have a dropdown menu, and when I make changes to it, I want a popup to appear asking for a hardcoded password. Only if I enter the correct password, the msg.payload should be forwarded. If the password is incorrect, nothing should happen.

I have made an attempt at implementing this functionality, but it has not been successful so far. Currently, I have simulated it by using a submit button and a text field where I enter a password.

Here is the (non-working) part of the flow I have implemented so far:

[
    {
        "id": "546b8641ca8d48e6",
        "type": "ui_dropdown",
        "z": "36c6ded58f79fc83",
        "name": "",
        "label": "Dropdown",
        "tooltip": "",
        "place": "Select option",
        "group": "cb79cf8d.1f211",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "Option 1",
                "value": "option1",
                "type": "str"
            },
            {
                "label": "Option 2",
                "value": "option2",
                "type": "str"
            },
            {
                "label": "Option 3",
                "value": "option3",
                "type": "str"
            }
        ],
        "payload": "",
        "topic": "",
        "topicType": "str",
        "className": "",
        "x": 150,
        "y": 660,
        "wires": [
            [
                "7444fd3e81fec442"
            ]
        ]
    },
    {
        "id": "7444fd3e81fec442",
        "type": "ui_template",
        "z": "36c6ded58f79fc83",
        "group": "cb79cf8d.1f211",
        "name": "",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<div ng-init=\"showPopup = false\">\n    <text-angular ng-show=\"showPopup\" ng-bind-html=\"popupContent\"></text-angular>\n</div>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 360,
        "y": 660,
        "wires": [
            [
                "b3d51745b4ef3d38"
            ]
        ]
    },
    {
        "id": "b3d51745b4ef3d38",
        "type": "function",
        "z": "36c6ded58f79fc83",
        "name": "Check Password",
        "func": "var password = 1234; // Hier das korrekte Passwort eintragen\n\nif (msg.payload == password) {\n    msg.showPopup = false; // Popup-Fenster ausblenden, wenn das Passwort korrekt ist\n    return msg; // Weiterleiten, wenn das Passwort korrekt ist\n} else {\n    msg.showPopup = true; // Popup-Fenster anzeigen, wenn das Passwort falsch ist\n    msg.popupContent = '<h2>Ungültiges Passwort</h2>'; // Fehlermeldung für das Popup-Fenster\n    return msg; // Keine Weiterleitung\n}\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 570,
        "y": 640,
        "wires": [
            [
                "1d57627dafdbfc2e"
            ]
        ]
    },
    {
        "id": "1d57627dafdbfc2e",
        "type": "debug",
        "z": "36c6ded58f79fc83",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 700,
        "wires": []
    },
    {
        "id": "cb79cf8d.1f211",
        "type": "ui_group",
        "name": "Dropdown",
        "tab": "dd43e6da.7e8eb8",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "dd43e6da.7e8eb8",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Maybe someone has an idea, hot solve this.

best regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.