Skip to content

Commit

Permalink
Merge pull request #37 from IsmaelMartinez/0.1.12
Browse files Browse the repository at this point in the history
0.1.12
  • Loading branch information
IsmaelMartinez authored Dec 20, 2018
2 parents e8b69c8 + 266089a commit 027130e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
15 changes: 1 addition & 14 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ app.commandLine.appendSwitch('auth-server-whitelist', config.authServerWhitelist
app.commandLine.appendSwitch('enable-ntlm-v2', config.ntlmV2enabled);

app.on('ready', () => {
let isFirstLoginTry = false;
let window = createWindow();
new Menus(window, config, iconPath);

Expand All @@ -32,19 +31,7 @@ app.on('ready', () => {
}
});

//login.handleLoginDialogTry(window.webContents);
window.webContents.on('login', (event, request, authInfo, callback) => {
event.preventDefault();
if (isFirstLoginTry) {
isFirstLoginTry = false;
login.loginService(window, callback);
} else {
// if fails to authenticate we need to relanch the app as we are closed
isFirstLoginTry = true;
app.relaunch();
app.exit(0);
}
});
login.handleLoginDialogTry(window);

window.webContents.setUserAgent(config.chromeUserAgent);

Expand Down
23 changes: 20 additions & 3 deletions app/login/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const {ipcMain, BrowserWindow} = require('electron');
const {app, ipcMain, BrowserWindow} = require('electron');
let isFirstLoginTry = true;

exports.loginService = function loginService(parentWindow, callback) {
exports.loginService = function loginService(parentWindow, callback) {
let win = new BrowserWindow({
width: 363,
height: 124,
Expand All @@ -26,4 +27,20 @@ exports.loginService = function loginService(parentWindow, callback) {
});

win.loadURL(`file://${__dirname}/login.html`);
};
};

exports.handleLoginDialogTry = function handleLoginDialogTry(window) {
window.webContents.on('login', (event, request, authInfo, callback) => {
event.preventDefault();
if (isFirstLoginTry) {
isFirstLoginTry = false;
this.loginService(window, callback);
} else {
// if fails to authenticate we need to relanch the app as we have close the login browser window.
isFirstLoginTry = true;
app.relaunch();
app.exit(0);
}
});
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "teams-for-linux",
"version": "0.1.11",
"version": "0.1.12",
"main": "app/index.js",
"description": "Unofficial client for Microsoft Teams for Linux",
"homepage": "https://github.com/IsmaelMartinez/teams-for-linux",
Expand Down

0 comments on commit 027130e

Please sign in to comment.