Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ... (existing code)
- local function activateUser(username)
- term.clear()
- term.setCursorPos(1, 1)
- print("Are you sure you want to activate user " .. username .. "? (yes/no)")
- local confirmation = read()
- if confirmation:lower() == "yes" then
- local disabledFile = fs.combine(USERS_FOLDER .. username, "disabled.txt")
- if fs.exists(disabledFile) then
- fs.delete(disabledFile)
- print("User activated successfully.")
- else
- print("User is already active.")
- end
- else
- print("User activation canceled.")
- end
- end
- local function main()
- local users = fs.list(USERS_FOLDER)
- if not users or #users == 0 then
- -- No users detected, run the BSOD program
- shell.run(ERROR_FOLDER .. BSOD_PROGRAM)
- else
- term.clear()
- term.setCursorPos(1, 1)
- print("Enter username:")
- local enteredUsername = read()
- if checkCredentials(enteredUsername) then
- activateUser(enteredUsername) -- New line to activate the user
- print("Access granted. Welcome, " .. enteredUsername .. "!")
- -- Your main OS code goes here
- else
- print("Access denied.")
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement