LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I make a password necessary program for different users?

I have to make a program for an automated storage. In this program it is necessary to log in with your name and password. How can I make such a program?

Is there a way to search for the right name-password combination in a .txt file?

 

I really look forward to an answer.  

0 Kudos
Message 1 of 15
(3,997 Views)

I think the answer depends on how secure you want it to be.

 

To keep it simple, you might just save the usernamd/password combinations in a text file.  But just make sure to encrypt them.  

 

Of course, someone could just delete that file and you are in trouble!

http://www.medicollector.com
0 Kudos
Message 2 of 15
(3,990 Views)

When assumed that nobody deleted that file. How can I make Labview search for the right combination? Do I have to use an array ore something?

0 Kudos
Message 3 of 15
(3,986 Views)

When you say different users, you meant there will be more than 1 user with unique password for each particular users.Then for large scale of deployment, I guess that best way is to have the program check the user name and password in a database if they are valid. 

 

 

0 Kudos
Message 4 of 15
(3,983 Views)

You need to read the file

You need to search for the user if it exists

You need to check with that user name, does the password match

 

If you allow user name to change the password, then there is more things you will need to take care

0 Kudos
Message 5 of 15
(3,980 Views)

It is not necacerry to change the password. 

 

Are there any function blocks for doing those actions? I'm not that familliar with Labview. 

0 Kudos
Message 6 of 15
(3,974 Views)

Sounds like you need to learn the basics before you do anything:

 

http://www.ni.com/academic/students/learn-labview/

 

 

And yes, arrays are involved.

http://www.medicollector.com
0 Kudos
Message 7 of 15
(3,946 Views)

Without encryption, everything you need can be accomplished with blocks from the File I/O pallete, the Array pallete, and the String Pallete.

 

0 Kudos
Message 8 of 15
(3,931 Views)

i would start by storing your multiple "username/password" in a 2D string file, read the 2D file and seperate into 1D usernames and passwords...do a 1D search on the arrays and compare if the element position matches, beware that the default index is -1, you need a # greater than/equal to 0 for a match.

passwrd.png

0 Kudos
Message 9 of 15
(3,914 Views)

It requires a bit more understanding of the underlying file structure, but I'd suggest using configuration files  (.ini) to store username-password as key-value combinations.  This way you can query a username directly using the configuration file API rather than searching. 

 

Untitled.png

 

Any obfuscation or encryption would use nearly identical logic. Makes for a much cleaner code and scales better- you could even store users as sections rather than keys and track any amount of user-specific data (in this case, you'd use a "Password" or similar key under the user's section).  There are a large number of config file examples available on ni.com with a bit of searching.

 

Regards,

Tom L.
0 Kudos
Message 10 of 15
(3,908 Views)