This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MonkeyDew's profile picture

A button changing the password of your computer

Started by MonkeyDew, 26 November 2012 - 04:45 AM
MonkeyDew #1
Posted 26 November 2012 - 05:45 AM
Is it possible to make it so if you type somthing into the computer or press a button to change the password on your computer.

E.G

> ChangePassword

- Log out


^ thats what i mean by buttons
ChunLing #2
Posted 26 November 2012 - 07:00 AM
Yes.
MonkeyDew #3
Posted 26 November 2012 - 07:16 AM
How?
Kingdaro #4
Posted 26 November 2012 - 07:24 AM
You're probably looking how to make a menu. Here's a nice video tutorial on it.
MonkeyDew #5
Posted 26 November 2012 - 07:28 AM
No i was just wondering how to make a program that changed the password for your computer
to what your input was
Kingdaro #6
Posted 26 November 2012 - 07:32 AM
To do that, you could just have a program ask for input, then store that input to a password file, to be loaded by whatever program asks for a password on startup.

-- ask for a new password
print 'Password?'
input = read()

-- store the password
local file = fs.open('your_password_file','w')
if file then
  file.write(input)
  file.close()
  print 'Successfully saved password'
else
  print 'Could not open password file'
end

If you're looking for a "button" to do it, as you first described, the tutorial I linked should help with that.