Skip to content

Commit 7b25c72

Browse files
authored
Make authenticated username available to scripts. (marcoskirsch#100)
See node_info.lua for usage example.
1 parent a2ebdee commit 7b25c72

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

http/node_info.lua

+1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ return function (connection, req, args)
2828
sendAttr(connection, 'Station IP address' , ip)
2929
sendAttr(connection, 'Station subnet mask' , subnetMask)
3030
sendAttr(connection, 'MAC address' , wifi.sta.getmac())
31+
sendAttr(connection, 'Auth user' , req.user)
3132
connection:send('</ul></body></html>')
3233
end

httpserver.lua

+1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ return function (port)
125125
end
126126

127127
if user and req.methodIsValid and (req.method == "GET" or req.method == "POST" or req.method == "PUT") then
128+
req.user = user
128129
handleRequest(connection, req, handleError)
129130
else
130131
local args = {}

0 commit comments

Comments
 (0)