Make authenticated username available to scripts. (#100)
See node_info.lua for usage example.
This commit is contained in:
@@ -28,5 +28,6 @@ return function (connection, req, args)
|
|||||||
sendAttr(connection, 'Station IP address' , ip)
|
sendAttr(connection, 'Station IP address' , ip)
|
||||||
sendAttr(connection, 'Station subnet mask' , subnetMask)
|
sendAttr(connection, 'Station subnet mask' , subnetMask)
|
||||||
sendAttr(connection, 'MAC address' , wifi.sta.getmac())
|
sendAttr(connection, 'MAC address' , wifi.sta.getmac())
|
||||||
|
sendAttr(connection, 'Auth user' , req.user)
|
||||||
connection:send('</ul></body></html>')
|
connection:send('</ul></body></html>')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ return function (port)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if user and req.methodIsValid and (req.method == "GET" or req.method == "POST" or req.method == "PUT") then
|
if user and req.methodIsValid and (req.method == "GET" or req.method == "POST" or req.method == "PUT") then
|
||||||
|
req.user = user
|
||||||
handleRequest(connection, req, handleError)
|
handleRequest(connection, req, handleError)
|
||||||
else
|
else
|
||||||
local args = {}
|
local args = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user