mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 09:05:36 +01:00
Added redis check to verify.
This commit is contained in:
parent
13fd3ccd16
commit
208fcb8418
4 changed files with 20 additions and 13 deletions
|
|
@ -14,14 +14,15 @@ export default async (req, res) => {
|
|||
const user = await getUser({ username });
|
||||
|
||||
if (user && checkPassword(password, user.password)) {
|
||||
const { id: userId, username, isAdmin } = user;
|
||||
|
||||
if (redis.enabled) {
|
||||
const token = `auth:${generateAuthToken()}`;
|
||||
const token = generateAuthToken();
|
||||
|
||||
await redis.set(token, user);
|
||||
|
||||
return ok(res, { token, user });
|
||||
}
|
||||
|
||||
const { id: userId, username, isAdmin } = user;
|
||||
const token = createSecureToken({ userId, username, isAdmin }, secret());
|
||||
|
||||
return ok(res, { token, user });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue