42 posts
Posted 22 July 2013 - 01:28 PM
I have a couple of programs that I am using, one for locking doors, and one for dailing stargates.
In these two programs a password is requested from the user, but the problem is the password is typed out in plain text, for anyone to see who is also watching the screen.
Is there a way to mask the input, so that other users can't "spy" and steal it?
Thanks ahead of time! Love this mod.
504 posts
Location
Seattle, WA
Posted 22 July 2013 - 01:33 PM
There sure is:
local input = read ('*')
You can call read with a mask character like the code above. That code will use the asterisk as a mask when printing the input back out during the read call.
42 posts
Posted 22 July 2013 - 01:52 PM
There sure is:
local input = read ('*')
You can call read with a mask character like the code above. That code will use the asterisk as a mask when printing the input back out during the read call.
This doesn't seem to work, unless I am doing something wrong, below is my code.
os.pullEvent=os.pullEventRaw
id = os.getComputerLabel()
while true do
shell.run("redset right true")
shell.run("redset left true")
shell.run("clear")
print("Please enter the password to gain access to this area:")
pass = read ('*')
content = http.get("http://smp.projectbuilder.info/fetch.php?cmd=page&ID=doorcheck&buffer=0&NAME=" .. id .. "&PASS=" .. pass)
s = content.readAll()
if s == "1" then
shell.run("redset right false")
shell.run("redset left false")
print("Success, the door has been opened. Please enter the area promptly.")
sleep(6)
shell.run("redset right true")
shell.run("redset left true")
else
print("Error, incorrect password, please try again")
sleep(3)
end
end
8543 posts
Posted 22 July 2013 - 01:54 PM
You're not checking the pass variable at all.
504 posts
Location
Seattle, WA
Posted 22 July 2013 - 02:09 PM
What do you mean by it's not working?
89 posts
Location
getServer().getPlayer("Thib0704").getLocation();
Posted 22 July 2013 - 02:38 PM
What version of CC/Minecraft are you using ?
3790 posts
Location
Lincoln, Nebraska
Posted 22 July 2013 - 02:43 PM
What version of CC/Minecraft are you using ?
The version of ComputerCraft has no bearing on this problem.
42 posts
Posted 22 July 2013 - 04:38 PM
Nevermind, I was updating the wrong pastebin code, it works perfectly now.
You're not checking the pass variable at all.
Yes I am, I am checking it against a database via PHP page.