Skip to content

Commit

Permalink
🔒 Prevent modification of users locally
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Aug 20, 2021
1 parent a8cf946 commit 46c1ea8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/ConfigAccumalator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@ export default class ConfigAccumulator {
/* App Config */
appConfig() {
let appConfigFile = {};
if (this.conf) {
appConfigFile = this.conf.appConfig || {};
}
// Set app config from file
if (this.conf) appConfigFile = this.conf.appConfig || {};
// Fill in defaults if anything missing
let usersAppConfig = defaultAppConfig;
if (localStorage[localStorageKeys.APP_CONFIG]) {
usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);
} else if (appConfigFile !== {}) {
usersAppConfig = appConfigFile;
}
// Some settings have their own local storage keys, apply them here
usersAppConfig.layout = localStorage[localStorageKeys.LAYOUT_ORIENTATION]
|| appConfigFile.layout || defaultLayout;
usersAppConfig.iconSize = localStorage[localStorageKeys.ICON_SIZE]
|| appConfigFile.iconSize || defaultIconSize;
usersAppConfig.language = localStorage[localStorageKeys.LANGUAGE]
|| appConfigFile.language || defaultLanguage;
// Don't let users modify users locally
if (this.conf.auth) usersAppConfig.auth = appConfigFile.auth;
// All done, return final appConfig object
return usersAppConfig;
}

Expand Down

0 comments on commit 46c1ea8

Please sign in to comment.