mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-31 19:27:00 -06:00
Electron-217
Added a warning dialog Updated to read method to read only from global config
This commit is contained in:
parent
d7f62a38b0
commit
919882a5b3
@ -425,6 +425,9 @@ module.exports = {
|
|||||||
saveUserConfig,
|
saveUserConfig,
|
||||||
clearCachedConfigs,
|
clearCachedConfigs,
|
||||||
|
|
||||||
readConfigFileSync
|
readConfigFileSync,
|
||||||
|
|
||||||
|
// use only if you specifically need to read global config fields
|
||||||
|
getGlobalConfigField,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { getConfigField } = require('./../config.js');
|
const { getGlobalConfigField } = require('./../config.js');
|
||||||
const parseDomain = require('parse-domain');
|
const parseDomain = require('parse-domain');
|
||||||
const isEqual = require('lodash.isequal');
|
const isEqual = require('lodash.isequal');
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ const isEqual = require('lodash.isequal');
|
|||||||
function isWhiteList(url) {
|
function isWhiteList(url) {
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
getConfigField('whiteListURL').then((whiteList) => {
|
getGlobalConfigField('whiteListURL').then((whiteList) => {
|
||||||
|
|
||||||
if (checkWhiteList(url, whiteList)) {
|
if (checkWhiteList(url, whiteList)) {
|
||||||
return resolve();
|
return resolve();
|
||||||
|
@ -463,11 +463,18 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.on('will-navigate', function(event, navigatedUrl){
|
// whenever the main window is navigated for ex: window.location.href or url redirect
|
||||||
// TODO: need inputs from design to implement error dialog
|
mainWindow.webContents.on('will-navigate', function(event, navigatedURL) {
|
||||||
isWhiteList(navigatedUrl).catch(() => {
|
isWhiteList(navigatedURL)
|
||||||
event.preventDefault();
|
.catch(() => {
|
||||||
});
|
event.preventDefault();
|
||||||
|
electron.dialog.showMessageBox(mainWindow, {
|
||||||
|
type: 'warning',
|
||||||
|
buttons: [ 'Ok' ],
|
||||||
|
title: 'Not Allowed',
|
||||||
|
message: `Sorry, you are not allowed to access this website (${navigatedURL}), please contact your administrator for more details`,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user