Using password field to make a button visible?

I'm fairly new to Ignition.

In Vision I want to use a "password field". Once the password is entered a "toggle button" is then visible.

image

Needless to say, I didn't get very far. :blush:

Thanks for any help! :slightly_smiling_face:

In the simplest form, you would bind the 'Visibility' property of the toggle button to an expression that compares the value in the password field with your known static password.

1 Like

Another option, instead of storing a password in your project (not a very secure method), is to use an expression binding on the visibility property that checks the length of the entered password, and if the password length is greater than X the button will be visible. Change it to the length of your password or use some other value, up to you.

This expression, on the visible property of the button, will enable the button visibility as long as 1 character has been entered in the password field.

if(len({Root Container.Password Field.text})>0, 1, 0)

How is that in any way more secure than to have a static password?

1 Like

Because storing a static password, as Paul suggested, in the project to compare against the entered password is not secure.

More secure than NO password. Sheesh.

Now you are putting words into my mouth...

Obviously you would use a password to authenticate the user, but the smart approach would be to take the entered password and verify the user with system.security.validateUser(). I am just offering a solution to enabling the visibility of the button.

The reason why comparing a static password saved into the project isn't a good idea, is because a user that doesn't have access to editing the project will have access to the .ignition cache on their local machine after launching said project. The .proj file found in the cache could then be restored to another gateway, opened in the designer, and the password is then compromised, if they aren't supposed to have it.

The most correct thing to do is absolutely not to hardcode a password string, nor any information about the password. Instead, you should just attempt to authenticate the user with whatever password (e.g. with system.security.switchUser, and then rely on component security to control component visibility. Attempting to 'pre-validate' the user is just begging for problems with out-of-sync auth.

1 Like

This is a very low security risk. Just to allow access to reset hours. So, I am just going to use an expression as PGriffith suggested.

Thanks Guys! :slight_smile: