iteration
This commit is contained in:
		
							
								
								
									
										4
									
								
								auth.lua
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								auth.lua
									
									
									
									
									
								
							@ -10,7 +10,7 @@ local action = args[1]
 | 
				
			|||||||
settings.define("auth.token", {
 | 
					settings.define("auth.token", {
 | 
				
			||||||
    description = "Authentication token",
 | 
					    description = "Authentication token",
 | 
				
			||||||
    type = "number",
 | 
					    type = "number",
 | 
				
			||||||
    default = ""
 | 
					    default = -1
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
settings.define("auth.server", {
 | 
					settings.define("auth.server", {
 | 
				
			||||||
@ -85,7 +85,7 @@ if action == "login" then
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if action == "logout" then
 | 
					if action == "logout" then
 | 
				
			||||||
    settings.set("auth.token", nil)
 | 
					    settings.set("auth.token", -1)
 | 
				
			||||||
    settings.save()
 | 
					    settings.save()
 | 
				
			||||||
    io.write("Logged out\n")
 | 
					    io.write("Logged out\n")
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
 | 
				
			|||||||
@ -104,7 +104,7 @@ while true do
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if request.action == "token" then
 | 
					    if request.action == "token" then
 | 
				
			||||||
        if request.token == nil or request.token == "" then
 | 
					        if request.token == nil or request.token == "" or request.token == -1 then
 | 
				
			||||||
            rednet.send(client_id, "invalid request", "auth")
 | 
					            rednet.send(client_id, "invalid request", "auth")
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user