mirror of
https://github.com/detleph/server.git
synced 2026-09-04 16:46:04 +02:00
Add redis
+ Add a public lib file for redis + Add an indexed auth client + Add a function to create promisified partial clients + Add password revisions to the auth redis index
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Request, Response } from "express";
|
||||
import { Admin, AdminLevel, Group } from "@prisma/client";
|
||||
import { authClient } from "../lib/redis";
|
||||
import prisma from "../lib/prisma";
|
||||
import argon2 from "argon2";
|
||||
import jwt from "jsonwebtoken";
|
||||
@@ -55,6 +56,9 @@ export const authenticateUser = async (req: Request<{}, {}, AuthenticateUserBody
|
||||
const param_password_hash = await argon2.hash(password, { type: argon2.argon2id });
|
||||
|
||||
if (param_password_hash === user.password) {
|
||||
// Set password revision ID in redis
|
||||
await authClient.set(user.pid, user.revision);
|
||||
|
||||
return {
|
||||
type: "success",
|
||||
payload: {
|
||||
|
||||
Reference in New Issue
Block a user