33 posts
Posted 31 December 2015 - 09:23 PM
Does anyone know how to make a if statement not caps sensitive? I am making a login program. Help appreciated! :)/>
2679 posts
Location
You will never find me, muhahahahahaha
Posted 31 December 2015 - 09:24 PM
You don't. if is just if and not IF. That is how Lua works.
33 posts
Posted 31 December 2015 - 09:32 PM
You don't. if is just if and not IF. That is how Lua works.
I has hoping if anyone know of any code that could do the comparison or convert all uppercase letters to lowercase or vice versa, but is wont be the end of the world is users need to get the capitals correct.
2679 posts
Location
You will never find me, muhahahahahaha
Posted 31 December 2015 - 09:33 PM
string.lower(text) will make text lower case.
355 posts
Location
Germany
Posted 31 December 2015 - 09:38 PM
You can convert a string to lower case ->
input1 = read() -- i.e. "Hello"
input2 = read() -- i.e. "hELLo"
lowercase1 = string.lower(input1) -- will be "hello"
lowercase2 = string.lower(input2) -- will be "hello"
if(lowercase1 == lowercase2) then
-- there you go. this block will be executed, when your inputs match in non-case-sensitive manner
end
When dealing with passwords and things, you should consider not to do this, since you loose entropy and therefor security.
So there will be much more ways to get into a single account. i mean, in computercraft this has no effect, but sticking to good practices is always a nice thing to do.
33 posts
Posted 31 December 2015 - 09:38 PM
string.lower(text) will make text lower case.
Thank you! :)/>
Edited on 31 December 2015 - 08:39 PM
33 posts
Posted 31 December 2015 - 09:44 PM
You can convert a string to lower case ->
input1 = read() -- i.e. "Hello"
input2 = read() -- i.e. "hELLo"
lowercase1 = string.lower(input1) -- will be "hello"
lowercase2 = string.lower(input2) -- will be "hello"
if(lowercase1 == lowercase2) then
-- there you go. this block will be executed, when your inputs match in non-case-sensitive manner
end
When dealing with passwords and things, you should consider not to do this, since you loose entropy and therefor security.
So there will be much more ways to get into a single account. i mean, in computercraft this has no effect, but sticking to good practices is always a nice thing to do.
I am creating a multi-user login system I am going to make the usernames not case sensitive but the passwords are, as is standard practice. Also, for security the passwords are stored in a hashed format preventing non-caps comparison.