fix: remove cache when generate new apikey
This commit is contained in:
parent
32d5c78709
commit
19b1ef1f37
@ -11,6 +11,7 @@ import * as utils from "../utils";
|
|||||||
import * as mail from "../mail";
|
import * as mail from "../mail";
|
||||||
import query from "../queries";
|
import query from "../queries";
|
||||||
import knex from "../knex";
|
import knex from "../knex";
|
||||||
|
import * as redis from "../redis";
|
||||||
import env from "../env";
|
import env from "../env";
|
||||||
|
|
||||||
const authenticate = (
|
const authenticate = (
|
||||||
@ -172,6 +173,8 @@ export const changePassword: Handler = async (req, res) => {
|
|||||||
export const generateApiKey = async (req, res) => {
|
export const generateApiKey = async (req, res) => {
|
||||||
const apikey = nanoid(40);
|
const apikey = nanoid(40);
|
||||||
|
|
||||||
|
redis.remove.user(req.user);
|
||||||
|
|
||||||
const [user] = await query.user.update({ id: req.user.id }, { apikey });
|
const [user] = await query.user.update({ id: req.user.id }, { apikey });
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user