30 posts
Posted 06 February 2016 - 07:21 AM
I'm good on programming but I need some help
How can I do a password locked os so u can do ur own password and login and logout
sorry for my english I'm from sweden
thanks for help
8543 posts
Posted 06 February 2016 - 07:32 AM
Moved to Ask a Pro.
2427 posts
Location
UK
Posted 06 February 2016 - 02:42 PM
If the password is to be changeable then you will have to store it in a file, this will need the
FS API
You may want to look into encrypting that file, there are several encryption APIs on the forums:
http://www.computercraft.info/forums2/index.php?app=core&module=search&do=search&fromMainBar=1Logging in is asking the user to input something and then comparing that to the password. If you have your program
run the shell then they can logout with the exit command.
You will need to make the program run on startup, you may want to provide another file to startup from.
Edited on 06 February 2016 - 01:45 PM
957 posts
Location
Web Development
Posted 06 February 2016 - 05:44 PM
You may want to look into encrypting that file, there are several encryption APIs on the forums:
http://www.computerc...h&fromMainBar=1
You should hash passwords when storing them. You don't need to encrypt them. Here's a good Hashing API:
http://www.computercraft.info/forums2/index.php?/topic/8169-sha-256-in-pure-lua/
749 posts
Location
BOO!!
Posted 19 February 2016 - 01:15 PM
I'm good on programming but I need some help
How can I do a password locked os so u can do ur own password and login and logout
thanks for help
In develepment I have an Os that asks for a password system at startup
Here are the main password files:
–something/password–
–[leave field blank, press save, do not type this comment in]—
–startup–
shell.run('something/startup')
–something/startup-
passwordf=io.open('something/password','r')password=passwordf:read()passwordf:close()print('Password Please?')if password==nil thenterm.clear()term.setCursorPos(1,1)shell.run('something/createpassword')shell.run('file')else if read('*')==password thenshell.run('file')elseprint('incorrect')sleep(1)os.shutdown()endend–something/createpassword–
print('You neeeed a password. You can currently only have one password, and no usernames')pw=io.open('NyanOs/password','w')pw:write(read('*'))pw:close()