Fix Electron SSO handling to support multiple profiles

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2020-04-14 13:29:47 +01:00
parent 90eb472e50
commit b9da31fc15
2 changed files with 85 additions and 29 deletions
+9 -2
View File
@@ -35,7 +35,7 @@ const tray = require('./tray');
const vectorMenu = require('./vectormenu');
const webContentsHandler = require('./webcontents-handler');
const updater = require('./updater');
const protocolInit = require('./protocol');
const {getProfileFromDeeplink, protocolInit, recordSSOSession} = require('./protocol');
const windowStateKeeper = require('electron-window-state');
const Store = require('electron-store');
@@ -86,7 +86,11 @@ if (argv["help"]) {
app.exit();
}
if (argv['profile-dir']) {
// check if we are passed a profile in the SSO callback url
const userDataPathInProtocol = getProfileFromDeeplink(argv["_"]);
if (userDataPathInProtocol) {
app.setPath('userData', userDataPathInProtocol);
} else if (argv['profile-dir']) {
app.setPath('userData', argv['profile-dir']);
} else if (argv['profile']) {
app.setPath('userData', `${app.getPath('userData')}-${argv['profile']}`);
@@ -339,6 +343,9 @@ ipcMain.on('ipcCall', async function(ev, payload) {
}
break;
}
case 'startSSOFlow':
recordSSOSession(args[0]);
break;
default:
mainWindow.webContents.send('ipcReply', {