# Password protection of toggle switch and button actions

**URL:** <https://forum.inductiveautomation.com/t/password-protection-of-toggle-switch-and-button-actions/82026>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 17, 2023, 7:01am UTC](https://forum.inductiveautomation.com/t/password-protection-of-toggle-switch-and-button-actions/82026 "2023-11-17T07:01:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pyrak](https://avatars.discourse-cdn.com/v4/letter/p/e0b2c6/32.png) [@Pyrak](https://forum.inductiveautomation.com/u/Pyrak)\
**Post date:** [November 17, 2023, 7:01am UTC](https://forum.inductiveautomation.com/t/password-protection-of-toggle-switch-and-button-actions/82026/1 "2023-11-17T07:01:03Z")

</div>

Hello everyone,  
I really need help setting password protection for button and toggle switch actions. My goal is to have a pop up keypad that allows users to enter password when the button/toggle switch clicked and actions of the buttons/toggle switch only take effect when the user input password == the preconfigured password.  
I will greatly appreciate a step by step guide on how to go about this.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [November 17, 2023, 8:25pm UTC](https://forum.inductiveautomation.com/t/password-protection-of-toggle-switch-and-button-actions/82026/3 "2023-11-17T20:25:17Z")

</div>

Require a user to log in before doing anything and then use session props to see if the user is authorized. Enable/disable components entirely based on authorization.

---

<div class="post-metadata">

**Author:** ![MSviga](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MSviga](https://forum.inductiveautomation.com/u/MSviga)\
**Post date:** [November 20, 2023, 7:02am UTC](https://forum.inductiveautomation.com/t/password-protection-of-toggle-switch-and-button-actions/82026/4 "2023-11-20T07:02:34Z")

</div>

How I would go about this is:

1. Create a custom session property to save the preconfigured pin.
2. Create a view for the keypad, I went ahead and threw together a quick one for you  
[TestProj\_2023-11-20\_0756.zip](https://forum.inductiveautomation.com/uploads/short-url/x99ZKOS5dqAz3nD2ucl1HYzFsdj.zip) (6.1 KB)
3. In this view, insert the code you actually want to execute in the "OK" button for example.
4. Call the view as a popup on your interface.

Then that should be it

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 20, 2023, 4:00pm UTC](https://forum.inductiveautomation.com/t/password-protection-of-toggle-switch-and-button-actions/82026/5 "2023-11-20T16:00:58Z")

</div>

I have to say something about this approach: preconfigured passwords are as useful as no password. You're far better off prompting the user with an [authentication challenge](https://docs.inductiveautomation.com/display/DOC81/system.perspective.authenticationChallenge).
