Make authenticated username available to scripts. (#100)

See node_info.lua for usage example.
This commit is contained in:
Marcos 2017-07-02 21:44:26 -05:00 committed by GitHub
parent a2ebdee334
commit 7b25c727fe
2 changed files with 2 additions and 0 deletions

View File

@ -28,5 +28,6 @@ return function (connection, req, args)
sendAttr(connection, 'Station IP address' , ip)
sendAttr(connection, 'Station subnet mask' , subnetMask)
sendAttr(connection, 'MAC address' , wifi.sta.getmac())
sendAttr(connection, 'Auth user' , req.user)
connection:send('</ul></body></html>')
end

View File

@ -125,6 +125,7 @@ return function (port)
end
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)
else
local args = {}