LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best approach for a password protected dialog

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

0 Kudos
Message 1 of 4
(2,807 Views)

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.  Smiley Very Happy

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
Message 2 of 4
(2,783 Views)

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!

Message 3 of 4
(2,767 Views)

Thank you for your comments and code, I have to figure out which one is more suitable for my application.

Message 4 of 4
(2,717 Views)