Merge pull request #264 from KiranNiranjan/ELECTRON-253

Electron-253 (Fixed an issue whit basic auth)
This commit is contained in:
Vikas Shashidhar 2017-12-22 15:55:14 +05:30 committed by GitHub
commit 029358f6b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,18 +111,12 @@ function openBasicAuthWindow(windowName, hostname, isValidCredentials, clearSett
ipc.on('login', (event, args) => {
if (typeof args === 'object' && typeof local.authCallback === 'function') {
local.authCallback(args.username, args.password);
basicAuthWindow.close();
closeAuthWindow(false);
}
});
ipc.on('close-basic-auth', () => {
if (typeof local.clearSettings === 'function') {
local.clearSettings();
}
if (basicAuthWindow) {
basicAuthWindow.close();
}
closeAuthWindow(true);
});
/**
@ -132,6 +126,19 @@ function destroyWindow() {
basicAuthWindow = null;
}
/**
* Method to close the auth window
* @param {boolean} clearSettings - Whether to clear the auth settings
*/
function closeAuthWindow(clearSettings) {
if (clearSettings && typeof local.clearSettings === 'function') {
local.clearSettings();
}
if (basicAuthWindow) {
basicAuthWindow.close();
}
}
module.exports = {
openBasicAuthWindow: openBasicAuthWindow