🔀 Merge pull request #887 from Cereal916/master

with built in auth, if user adds a capital letter to username they ca…
This commit is contained in:
Alicia Sykes 2022-09-10 21:52:41 +01:00 committed by GitHub
commit e2fb5fcaf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,7 +150,7 @@ export const getCurrentUser = () => {
let foundUserObject = false; // Value to return let foundUserObject = false; // Value to return
getUsers().forEach((user) => { getUsers().forEach((user) => {
// If current logged-in user found, then return that 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; return foundUserObject;
}; };
@ -180,7 +180,7 @@ export const isUserAdmin = () => {
const currentUser = localStorage[localStorageKeys.USERNAME]; const currentUser = localStorage[localStorageKeys.USERNAME];
let isAdmin = false; let isAdmin = false;
users.forEach((user) => { users.forEach((user) => {
if (user.user === currentUser) { if (user.user.toLowerCase() === currentUser.toLowerCase()) {
if (user.type === 'admin') isAdmin = true; if (user.type === 'admin') isAdmin = true;
} }
}); });