🔀 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

View File

@@ -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;
}
});