mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Fixed auth check.
This commit is contained in:
parent
85382e25af
commit
aaf8b1935f
3 changed files with 7 additions and 5 deletions
|
|
@ -22,6 +22,7 @@ export async function parseRequest(
|
|||
let query = Object.fromEntries(url.searchParams);
|
||||
let body = await getJsonBody(request);
|
||||
let error: () => void | undefined;
|
||||
let auth = null;
|
||||
|
||||
if (schema) {
|
||||
const isGet = request.method === 'GET';
|
||||
|
|
@ -36,10 +37,12 @@ export async function parseRequest(
|
|||
}
|
||||
}
|
||||
|
||||
const auth = !error && !options?.skipAuth ? await checkAuth(request) : null;
|
||||
if (!options?.skipAuth && !error) {
|
||||
auth = await checkAuth(request);
|
||||
|
||||
if (!error && !auth) {
|
||||
error = () => unauthorized();
|
||||
if (!auth) {
|
||||
error = () => unauthorized();
|
||||
}
|
||||
}
|
||||
|
||||
return { url, query, body, auth, error };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue