From e71b586fe5d8b7d4cbc9d6bd46cc52f6d8eacd78 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sun, 14 Apr 2024 23:50:31 -0400 Subject: [PATCH] Invalidate cached user when the user's email address is changed --- packages/backend/src/routers/change_email.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/backend/src/routers/change_email.js b/packages/backend/src/routers/change_email.js index 101ff940..6e2a4c67 100644 --- a/packages/backend/src/routers/change_email.js +++ b/packages/backend/src/routers/change_email.js @@ -26,6 +26,7 @@ const { DB_READ, DB_WRITE } = require('../services/database/consts.js'); const config = require('../config.js'); const jwt = require('jsonwebtoken'); +const { invalidate_cached_user_by_id } = require('../helpers.js'); const CHANGE_EMAIL_START = eggspress('/change_email/start', { subdomain: 'api', @@ -110,6 +111,7 @@ const CHANGE_EMAIL_CONFIRM = eggspress('/change_email/confirm', { [new_email, user_id] ); + invalidate_cached_user_by_id(user_id); let socketio = require('../socketio.js').getio(); if(socketio){ socketio.to(user_id).emit('user.email_changed', {})