Add assert for login/password

master
Евгений Макаров 2021-07-15 00:04:10 +05:00
parent 1c78a3703a
commit 0182a4676a
1 changed files with 3 additions and 1 deletions

View File

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