12-21-2023 06:27 AM
Hello,
I am trying to develop a User interface login and signup. And I am trying to check if a username already exists. So far this is what I have done.
Thank you
12-21-2023 06:45 AM - edited 12-21-2023 06:47 AM
@eneko.mujika wrote:
I am trying to develop a User interface login and signup.
And I am trying to check if a username already exists.
So far this is what I have done.
And what's the question?
12-21-2023 11:55 AM
Cleaned it up a bit:
12-21-2023 02:11 PM
If you just want to see if a user exists, build a set.
If you want to see if a user exists and if yes, also lookup the password, build a map.
(Compared to array operations, it makes little difference for small datasets, but would be significantly more efficient once you have thousands of users. sets and maps also have better error checking, because duplicate users cannot exist.)
12-21-2023 02:32 PM
I'd say if I were really doing it, I'd want to either use a database or an actually secure toolkit for things.
12-21-2023 02:38 PM
Yes, of course. The password in the file could be stored as encrypted string (e.g. MD5) to be compared with the encrypted password entered. A very mild layer of security. Yes, there are better ways!
Here's a quick demo how you would use a map. As I said, the password should never exist in clear text on the diagram or in the file.