View difference between Paste ID: 2RG9axzz and PGSY1YKK
SHOW: | | - or go back to the newest paste.
1-
userName = ("Master")			-- Username.
1+
userName = ("IzzLucas")			-- Username.
2-
passWord = ("3735")			-- Password.
2+
passWord = ("2110")			-- Password.
3
debugPassword = ("dmpass")	-- Password for getting in to debug mode.
4
triesSecure = true				-- Change to false if you want unlimited tries to open the system.
5
triesMax = 3					-- How many tries a user got before the system will close.
6
destination = "program"			-- Program that will start if username and password is correct.
7-
sleepTime = 3					-- For how long a user is locked out of the system if he/she keeps ketting password or username wrong. This is in seconds.
7+
sleepTime = 100					-- For how long a user is locked out of the system if he/she keeps ketting password or username wrong. This is in seconds.
8
9
triesUsed = 0					-- Do not change this!
10
unlocked = false				-- Do not change this!
11
version = "1.0"					-- Do not change this!
12
13
function authVerify() 
14
 if triesSecure == true then
15
  if unlocked == false and triesUsed < triesMax then
16
   write("Username: ")
17
   userNameInput = read()
18
    
19
   if userNameInput == debugPassword then
20
    shell.run"clear"
21
    shell.run"shell"
22
	
23
   else
24
   write("Password: ")
25
   passWordInput = read("*")
26
 
27
    if passWordInput == passWord and userNameInput == userName then
28
     unlocked = true
29
     correct()
30
  
31
   else
32
    triesUsed = triesUsed + 1
33
    textutils.slowPrint("Username or password was not correct.")
34
    textutils.slowPrint("You have " .. triesMax - triesUsed .. " tries left.")
35
	authVerify()
36
   end
37
  end
38
 end
39
40
41
  if triesUsed == triesMax or triesUsed > triesMax then
42
   incorrect()
43
  end
44
 end
45
46
 if triesSecure == false and unlocked == false then
47
  write("Username: ")
48
  userNameInput = read()
49
  
50
  if userNameInput == debugPassword then
51
  shell.run"clear"
52
  shell.run"shell"
53
 
54
  else 
55
   write("Password: ")
56
   passWordInput = read("*")
57
 
58
   if passWordInput == passWord and userNameInput == userName then
59
    unlocked = true
60
    correct()
61
  
62
   else 
63
    textutils.slowPrint("Username or password was not correct.")
64
    authVerify()
65
   end
66
  end
67
 end
68
end
69
70
function correct()
71
 textutils.slowPrint("Password and username was correct, welcome.")
72
 textutils.slowPrint(userNameInput)
73
 print("")
74
 textutils.slowPrint("Signed in as:")
75
 textutils.slowPrint(userNameInput)
76
 sleep(1)
77
 shell.run(destination)
78
end
79
80
function incorrect()
81
 textutils.slowPrint("Due to multiple tries, you have been locked")
82
 textutils.slowPrint(" out from the system.")
83
 sleep(sleepTime)
84
 triesUsed = 0
85
 authVerify()
86
end
87
88
textutils.slowPrint("You need to be logged in:")
89
authVerify()