File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -9,21 +9,21 @@ function basicAuth.authenticate(header)
99 -- Parse basic auth http header.
1010 -- Returns the username if header contains valid credentials,
1111 -- nil otherwise.
12- local credentials_enc = header :match (" Authorization: Basic ([A-Za-z0-9+/=]+)" )
12+ local credentials_enc = header :match (" Authorization: Basic ([A-Za-z0-9+/=]+)" )
1313 if not credentials_enc then
1414 return nil
1515 end
16- local credentials = dofile (" b64 .lc" ). decode (credentials_enc )
16+ local credentials = dofile (" httpserver-b64decode .lc" )(credentials_enc )
1717 local user , pwd = credentials :match (" ^(.*):(.*)$" )
1818 if user ~= conf .auth .user or pwd ~= conf .auth .password then
1919 return nil
20- end
21- print (" httpserver-basicauth: User " .. user .. " authenticated." )
20+ end
21+ print (" httpserver-basicauth: User \" " .. user .. " \ " authenticated." )
2222 return user
2323end
2424
2525function basicAuth .authErrorHeader ()
26- return " WWW-Authenticate: Basic realm=\" nodemcu-httpserver \" "
26+ return " WWW-Authenticate: Basic realm=\" " .. conf . auth . realm .. " \" "
2727end
2828
2929return basicAuth
You can’t perform that action at this time.
0 commit comments