Update auth logic.

This commit is contained in:
Mike Cao 2022-11-09 10:16:50 -08:00
parent 76cad96a24
commit d2100c33b7

View File

@ -30,10 +30,11 @@ export const useAuth = createMiddleware(async (req, res, next) => {
const shareToken = await parseShareToken(req);
let user;
if (redis.enabled && !validate(key)) {
user = await redis.get(key);
} else {
if (validate(key)) {
user = await getUser({ id: key });
} else if (redis.enabled) {
user = await redis.get(key);
}
if (!user && !shareToken) {