Simpler implementation of HTTP basic auth, fixes #56

This commit is contained in:
Michael Gielda
2016-03-29 17:56:03 +02:00
parent ef8eebc8d0
commit 3af9b31000
2 changed files with 13 additions and 0 deletions

View File

@@ -49,6 +49,18 @@ var mainWindow = null;
var trayIcon = null;
var willAppQuit = false;
app.on('login', function (event, webContents, request, authInfo, callback) {
event.preventDefault();
var readlineSync = require('readline-sync');
console.log("HTTP basic auth requiring login, please provide login data.");
var username = readlineSync.question('Username: ');
var password = readlineSync.question('Password: ', {
hideEchoBack: true
});
console.log("Replacing default auth behaviour.");
callback(username, password);
});
// Quit when all windows are closed.
app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar

View File

@@ -15,6 +15,7 @@
"react": "^0.14.3",
"react-bootstrap": "^0.28.1",
"react-dom": "^0.14.3",
"readline-sync": "^1.4.1",
"yargs": "^3.31.0"
}
}