From 5017c4505464bf63e3e9a4ca12ad7eeaa8abdc0d Mon Sep 17 00:00:00 2001 From: Marcus Koh Date: Sat, 26 Jun 2021 23:51:40 +0800 Subject: [PATCH 1/3] Disable profile page if user is disabled --- pages/api/silentLogin.js | 1 + pages/profile/[userId].js | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pages/api/silentLogin.js b/pages/api/silentLogin.js index 8622bb18..e7e171e2 100644 --- a/pages/api/silentLogin.js +++ b/pages/api/silentLogin.js @@ -44,6 +44,7 @@ async function handler(req, res) { emailVerified: currentUser.emailVerified, email: decodedClaims.email, isClaimSet: isClaimSet, + disabled: currentUser.disabled, }, }); } catch (error) { diff --git a/pages/profile/[userId].js b/pages/profile/[userId].js index bf85428a..950a9104 100644 --- a/pages/profile/[userId].js +++ b/pages/profile/[userId].js @@ -37,12 +37,19 @@ const Profile = ({ user, userId, userTypes }) => { return ( - {userTypes ? null : } - {containsNPO(userTypes) ? ( - - ) : containsDonor(userTypes) ? ( - - ) : null} + {user.disabled ? ( + + ) : ( + <> + {userTypes ? null : } + {containsNPO(userTypes) ? ( + + ) : containsDonor(userTypes) ? ( + + ) : null} + + )} +