In addition to what Espen just said...
Since you want to also allow user input you will need to slightly modify how his code works, like so
This line
local _, timer = os.pullEvent("timer")
would need to become
local event, param1 = os.pullEvent()
and then you would need to check the events and go from there, essentially you are making your own read function
if event == 'timer' then
-- Espens code here
elseif event == 'char' then
-- add the char to the input string
elseif event == 'key' then
-- check for backspace and enter here
end
you would then need a string at the top of your code like this
local input = ""
and this is what you append to
if event == 'char' then
input = input..param1
elseif event == 'key' then
if param1 == keys.backspace then
input = string.sub( input, 1, string.len(input) - 1 )
elseif param1 == keys.enter then
-- ok check the password here and do whatever you want the program to do when it is correct, when false just input = "" again
end
end