Add assert for login/password
parent
1c78a3703a
commit
0182a4676a
|
@ -20,6 +20,8 @@ local decode_authorization = function(header)
|
||||||
local auth_string_b64 = string.match(header, "^Basic%s([^%s]+)$")
|
local auth_string_b64 = string.match(header, "^Basic%s([^%s]+)$")
|
||||||
local auth_string, _ = mime.unb64(auth_string_b64)
|
local auth_string, _ = mime.unb64(auth_string_b64)
|
||||||
local login, password = string.match(auth_string, "^([^:]+)[:](.+)$")
|
local login, password = string.match(auth_string, "^([^:]+)[:](.+)$")
|
||||||
|
assert(login ~= nil and login ~= "", [[Login empty!]])
|
||||||
|
assert(password ~= nil and password ~= "", [[Password empty!]])
|
||||||
return login, password
|
return login, password
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,7 +61,7 @@ function _M.run(wsapi_env)
|
||||||
|
|
||||||
-- make normal username
|
-- make normal username
|
||||||
local username = string.format("%s%s%s", login_prefix, login, login_suffix)
|
local username = string.format("%s%s%s", login_prefix, login, login_suffix)
|
||||||
|
|
||||||
local status, err = pcall(bind, dc, username, password)
|
local status, err = pcall(bind, dc, username, password)
|
||||||
if (not status) then
|
if (not status) then
|
||||||
log(err)
|
log(err)
|
||||||
|
|
Loading…
Reference in New Issue