mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
fix redis auth issue
This commit is contained in:
parent
3325df0d84
commit
448d2b2241
@ -36,13 +36,7 @@ export const useAuth = createMiddleware(async (req, res, next) => {
|
||||
const shareToken = await parseShareToken(req);
|
||||
|
||||
let user = null;
|
||||
let userId = null;
|
||||
|
||||
const { authKey } = payload || {};
|
||||
|
||||
if (typeof payload === 'string') {
|
||||
userId = payload;
|
||||
}
|
||||
const { userId, authKey } = payload || {};
|
||||
|
||||
if (validate(userId)) {
|
||||
user = await getUser({ id: userId });
|
||||
|
@ -47,7 +47,7 @@ export default async (
|
||||
return ok(res, { token, user });
|
||||
}
|
||||
|
||||
const token = createSecureToken(user.id, secret());
|
||||
const token = createSecureToken({ userId: user.id }, secret());
|
||||
|
||||
return ok(res, { token, user });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user