diff --git a/src/utils/Auth.js b/src/utils/Auth.js index 8af5c458..3fd00d44 100644 --- a/src/utils/Auth.js +++ b/src/utils/Auth.js @@ -52,7 +52,7 @@ export const isLoggedIn = () => { /* Returns true if authentication is enabled */ export const isAuthEnabled = () => { const users = getUsers(); - return (users && users.length > 0); + return (users.length > 0); }; /* Returns true if guest access is enabled */ @@ -151,7 +151,7 @@ export const isLoggedInAsGuest = () => { */ export const isUserAdmin = () => { const users = getUsers(); - if (!users || users.length === 0) return true; // Authentication not setup + if (users.length === 0) return true; // Authentication not setup if (!isLoggedIn()) return false; // Auth setup, but not signed in as a valid user const currentUser = localStorage[localStorageKeys.USERNAME]; let isAdmin = false; @@ -172,10 +172,8 @@ export const isUserAdmin = () => { * then they will never be able to view the homepage, so no button needed */ export const getUserState = () => { - const appConfig = getAppConfig(); const { notConfigured, loggedIn, guestAccess } = userStateEnum; // Numeric enum options - const users = appConfig.auth || []; // Get auth object - if (!isAuthEnabled(users)) return notConfigured; // No auth enabled + if (!isAuthEnabled()) return notConfigured; // No auth enabled if (isLoggedIn()) return loggedIn; // User is logged in if (isGuestAccessEnabled()) return guestAccess; // Guest is viewing return notConfigured; diff --git a/src/utils/ConfigAccumalator.js b/src/utils/ConfigAccumalator.js index 30fc6be3..2edae611 100644 --- a/src/utils/ConfigAccumalator.js +++ b/src/utils/ConfigAccumalator.js @@ -41,7 +41,7 @@ export default class ConfigAccumulator { usersAppConfig.language = localStorage[localStorageKeys.LANGUAGE] || appConfigFile.language || defaultLanguage; // Don't let users modify users locally - if (this.conf.auth) usersAppConfig.auth = appConfigFile.auth; + if (appConfigFile.auth) usersAppConfig.auth = appConfigFile.auth; // All done, return final appConfig object return usersAppConfig; }