17 posts
Posted 13 June 2012 - 12:03 AM
Hello, I have a log in system on my computer, I want to create a program that I can create user without editing startup, with default command like, delete user, add user, add password, delete password, etc…. This there anyway to do this, also if there is I need help, when writing the code in a reply could you please explain it for I know how to use it? Thanks
92 posts
Posted 13 June 2012 - 03:49 AM
If someone creates a log-in system for a computer, there should always be an admin account and either blank password or 'admin' for password so you can access the computer and add new users or some type of setup. If there isn't, perhaps suggest that to the program author.
Not sure if what you're asking is possible without editing program. Post code? (in a spoiler)
17 posts
Posted 13 June 2012 - 04:36 AM
I was asking for a lua code
92 posts
Posted 13 June 2012 - 05:05 AM
Hello, I have a log in system on my computer…etc
Post code?
This way I will be able to check if something like you're asking for is even possible, and if you want the code, I'd need to study it so I could actually write the code.
17 posts
Posted 14 June 2012 - 12:34 AM
Here ill right it out
term.clear()
term.setCursorPos(1,1)
local password = "11428"
write("Insert Password:")
local input = read("*")
if input == (password) then
term.clear()
term.setCursorPos(1,1)
print("Password Accepted! Welcome Zane!")
sleep(2)
else
term.clear()
term.setCursorPos(1,1)
print("Password Denied!")
sleep(2)
os.reboot()
end
1111 posts
Location
Portland OR
Posted 14 June 2012 - 12:07 PM
Basically what you want to do is store the users and their passwords in a file and have your program edit the files.
Take a look at my login API if you would like an example.
http://www.computercraft.info/forums2/index.php?/topic/1397-login-scriptapi-with-multi-users-and-permissionupdated-v11/
992 posts
Posted 14 June 2012 - 12:21 PM
What about login via a remote network authentication sever.would allow for multiple computers to share user authentication set. also would allow for loging of when user were active.I might take a run at that.
134 posts
Location
Salt Lake, UT
Posted 14 June 2012 - 03:55 PM
From my experience with the rednet… I would recomend using the os.pullEvent() in this situation. For my login system i use the floppies as "ID" badges. Once they insert their floppy it will automatically get the ID's name and know what pass to ask. It can ask via rednet for the pass
disk.eject("side") -- we don't want to trigger the event with an eject
local a = os.pullEvent("disk") -- checks for a disk to be inserted
--Depending on where your server is located you would program here. If you intend it to go through a "network" just program the next leg and so on...
name = disk.getLabel("side") -- we need the name of the disk
rednet.send("ID", name) -- for the Id you will put the next leg in the network. if you have networking questions let me know. then DO NOT PUT name IN "". WE WANT THE VARIABLE TO SEND not the word name.
local b,c,d = os.pullEvent("rednet_message") -- limiting event to rednet message
-- personally i do not like to use rednet broadcast. If you are using that function you will need to put something right here to filter your results.
-- now that we have sent the username you will have the server send back the password. it will be in varriable c
disk.eject("side") -- eject ID card
x = read("*") -- makes password look like *****
if x == c then
-- if they get the password right then write that code here
else
-- wrong password
end
-- you may want to enclose this code in a while true do function but that is optional.
-- if you have any questions let me know
Final notes:
1) Let me know if that didn't understand
2) I do not like using the rednet.broadcast() function. reason being you will always be sending it to a specific place. Even though it will be just a little harder to code. you will be thankful in the end.
3) I have had questions why i don't "hide" the password in a floppy. Reason: People can get it. it is simple.