10-05-2017 02:26 PM
What is the best approach to design a dialog box(menu) that can only be accessed by pressing a button on the front panel and entering a password:
button press > ask for password dialog > { correct password ==> show dialog(sub vi)
incorrect password ==> return to main front panel
}
The idea is to have an advanced settings menu which is password protected.
Thanks very much
H7N
10-05-2017 02:51 PM
Here is a very simple VI that returns a boolean value indicating login success. You'll probably NOT want to use a hard-coded master password like this but instead have some sort of user database where you store MD5 hash values of their passwords. When a user clicks login, calculate the MD5 hash of their inputted password and compare it to passwords in the "database". You can get as fancy as you want with this. I coded it to only iterate once, meaning that if you press either button, the window closes. This doesn't allow for retries without opening the window again.
Play with the window properties to make it look like a proper dialog box. Modal is likely what you want because you don't want the dialog box to open and then disappear when a user clicks off of it.
BE CAREFUL USING MODAL WINDOWS!!!! You have been warned.
10-05-2017 03:32 PM
Here is a login GUI I wrote a few years ago. Ended up not using it in favor of a better method... but for a simple case you could easily use it.
Disclaimer: it isn't pretty... I gutted some code and comments from it it, hit the BD cleanup "sweep", and clicked save. But it is a place to start!
10-16-2017 07:56 PM
Thank you for your comments and code, I have to figure out which one is more suitable for my application.