LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

user id password

Solved!
Go to solution

How to create a login ID and password just like in the case of any website?

Suppose a new user is there, at first he should create his own login ID and password that will be stored in some file.Then whenever the next time he tries to open up the VI and enters his login ID and password it should be searched and matched up with the one stored in the file and then user should be given the access.

And there might be many users.

0 Kudos
Message 1 of 11
(4,048 Views)
0 Kudos
Message 2 of 11
(4,036 Views)

In that a constant is provided for the password.

But how to read and match User ID and Password from a particular file?

0 Kudos
Message 3 of 11
(4,029 Views)

Hi Sunny,

 

"But how to read and match User ID and Password from a particular file?"

Well, I would read the file, search for the given UserID to get the predefined password and compare that with the user given one...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 11
(4,020 Views)

As GerdW mentioned you need to read & write using the functions in File IO palette

 

I have attached a sample vi to read/write data .There are many ways to to do it.

 

Following links are useful.

 

https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/menus/categories/programming/file-mnu.html

 

 

http://zone.ni.com/reference/en-XX/help/371361D-01/lvconcepts/choosing_a_file_i_o_format/ 

 

0 Kudos
Message 5 of 11
(4,014 Views)

Thanks for the reply.

I was looking at the example shipped with LabVIEW, Login Dialog.vi.There they have used the table control.

I am able to write the data in an excel sheet, that means I am able to create New User ID and Password.But not able to read from the file and compare it.

Is it ok to write it to an excel file? or just use the write to text function and then read from it? and how to compare it with the ID and Password entered by the user for further authentication? 

0 Kudos
Message 6 of 11
(4,002 Views)

"Well, I would read the file, search for the given UserID to get the predefined password and compare that with the user given one".

I'm afraid but thats the part I am not getting how to do.Smiley Sad

Create User ID and password, & Read the file - Ok.

But how to search the User ID to get its created password and compare it with the one entered by the user?

0 Kudos
Message 7 of 11
(3,997 Views)
Solution
Accepted by Sunny1290

Hi Sunny,

 

"Create User ID and password, & Read the file - Ok."

- How can I suggest anything when you don't tell how your file is organized/formatted?

- Even saying "I'm using an Excel file" isn't sufficient as it's a huge difference to use real Excel files (xls, xlsx) or plain text files (cst, txt) which can be read by Excel too.

 

I can only suggest to use a csv file, read it with ReadSpreadsheetFile, use Search1DArray to search the UserID column for your user and index the password column for the password check. That's pretty basic, requiring only 5 or 6 ready-to-use LabVIEW functions. If you aren't able to set it up on your own I would recommend to go through the LabVIEW basic courses offered by NI...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(3,995 Views)

Hi Sunny,

 

here's the simplest solution I can think of:

check.png

As easy as I told you: read the file, search for UserID, check password...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(3,983 Views)

Hi GerdW,

Thanks a lot its done.Smiley Happy

0 Kudos
Message 10 of 11
(3,979 Views)