mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 12:47:13 +01:00
Updated middleware check.
This commit is contained in:
parent
e9b1869eb8
commit
091716e037
1 changed files with 2 additions and 2 deletions
|
|
@ -26,11 +26,11 @@ export const useSession = createMiddleware(async (req, res, next) => {
|
|||
|
||||
export const useAuth = createMiddleware(async (req, res, next) => {
|
||||
const token = getAuthToken(req);
|
||||
const payload = parseSecureToken(token, secret()) || {};
|
||||
const payload = parseSecureToken(token, secret());
|
||||
const shareToken = await parseShareToken(req);
|
||||
|
||||
let user;
|
||||
const { userId, key } = payload;
|
||||
const { userId, key } = payload || {};
|
||||
|
||||
if (validate(userId)) {
|
||||
user = await getUser({ id: userId });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue