[task-192] add log stuff

This commit is contained in:
Fenris Wolf 2025-09-04 09:53:18 +00:00
parent 6ad47e1943
commit fc228fb274
2 changed files with 23 additions and 25 deletions

View file

@ -45,7 +45,7 @@ namespace _zeitbild.api
);
if (authorization_string === null)
{
return Promise.reject();
return Promise.reject(new Error("authorization header missing"));
}
else
{
@ -62,7 +62,7 @@ namespace _zeitbild.api
"strategy": strategy,
}
);
return Promise.reject();
return Promise.reject(new Error("unhandled authorization strategy: " + strategy));
break;
}
case "Basic":
@ -87,38 +87,36 @@ namespace _zeitbild.api
else
{
const user_object : _zeitbild.type_user_object = await _zeitbild.service.user.get(user_id);
const password_shall : string = (
(user_object.dav_token !== null)
?
user_object.dav_token
:
/**
* @todo deprecate?
*/
lib_plankton.sha256.get(
username,
_zeitbild.conf.get()["misc"]["auth_salt"]
)
);
if (! (password_is === password_shall))
if (user_object.dav_token !== null)
{
/**
* @todo remove
*/
lib_plankton.log.notice(
"zeitbild.web_auth.wrong_pasword",
"zeitbild.user_from_web_auth.dav_token_unset",
{
"shall": password_shall,
"is": password_is,
"user_id": user_id,
}
);
return Promise.reject();
return Promise.reject(new Error("DAV token unset"));
}
else
{
const password_shall : string = user_object.dav_token;
if (! (password_is === password_shall))
{
lib_plankton.log.notice(
"zeitbild.user_from_web_auth.wrong_password",
{
"user_id": user_id,
"password_is": password_is,
}
);
return Promise.reject(new Error("wrong password"));
}
else
{
return Promise.resolve({"id": user_id, "object": user_object});
}
}
}
break;
}
}