From 9c15314af855e756c83c8f52bf409d10fb793ede Mon Sep 17 00:00:00 2001 From: kristian Date: Mon, 5 Sep 2022 20:40:56 -0700 Subject: [PATCH] with built in auth, if user adds a capital letter to username they can see all items. --- src/utils/Auth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/Auth.js b/src/utils/Auth.js index df9f3478..f257c440 100644 --- a/src/utils/Auth.js +++ b/src/utils/Auth.js @@ -150,7 +150,7 @@ export const getCurrentUser = () => { let foundUserObject = false; // Value to return getUsers().forEach((user) => { // If current logged-in user found, then return that user - if (user.user === username) foundUserObject = user; + if (user.user.toLowerCase() === username.toLowerCase()) foundUserObject = user; }); return foundUserObject; }; @@ -180,7 +180,7 @@ export const isUserAdmin = () => { const currentUser = localStorage[localStorageKeys.USERNAME]; let isAdmin = false; users.forEach((user) => { - if (user.user === currentUser) { + if (user.user.toLowerCase() === currentUser.toLowerCase()) { if (user.type === 'admin') isAdmin = true; } });