diff --git a/app/js/main.js b/app/js/main.js index 6cf3dde0..bb77f257 100644 --- a/app/js/main.js +++ b/app/js/main.js @@ -1566,6 +1566,8 @@ var App = (function(App, undefined) { "showStatus": settings.showStatusBar, "host": (settings.lightWallet == 1 ? settings.lightWalletHost : "http://localhost"), "port": (settings.lightWallet == 1 ? settings.lightWalletPort : settings.port), + "auth_user": (settings.lightWallet == 1 ? settings.lightWalletUser : null), + "auth_password": (settings.lightWallet == 1 ? settings.lightWalletPassword : null), "depth": settings.depth, "minWeightMagnitude": settings.minWeightMagnitude, "ccurlPath": ccurlPath, @@ -2017,8 +2019,16 @@ var App = (function(App, undefined) { walletType = settings.lightWallet; } if (walletType == 1) { - var config = {"lightWallet": 1, "lightWalletHost": settings.lightWalletHost, "lightWalletPort": settings.lightWalletPort, "minWeightMagnitude": settings.minWeightMagnitude, "testNet": isTestNet, "minWeightMagnitudeMinimum": minWeightMagnitudeMinimum}; - + var config = { + "lightWallet": 1, + "lightWalletHost": settings.lightWalletHost, + "lightWalletPassword": settings.lightWalletPassword, + "lightWalletPort": settings.lightWalletPort, + "lightWalletUser": settings.lightWalletUser, + "minWeightMagnitude": settings.minWeightMagnitude, + "testNet": isTestNet, + "minWeightMagnitudeMinimum": minWeightMagnitudeMinimum + }; var req = https.get('https://iotasupport.com/providers.json?' + (new Date().getTime())); req.on('response', function (res) { var body = ''; @@ -2108,6 +2118,22 @@ var App = (function(App, undefined) { lightWalletHostChange = true; } } + + if (configuration.hasOwnProperty("lightWalletUser")) { + var lightWalletUser = configuration.lightWalletUser; + if (lightWalletUser != settings.lightWalletUser) { + settings.lightWalletUser = lightWalletUser; + lightWalletHostChange = true; + } + } + + if (configuration.hasOwnProperty("lightWalletPassword")) { + var lightWalletPassword = configuration.lightWalletPassword; + if (lightWalletPassword != settings.lightWalletPassword) { + settings.lightWalletPassword = lightWalletPassword; + lightWalletHostChange = true; + } + } } else { if (configuration.hasOwnProperty("nodes")) { var nodes = []; diff --git a/app/windows/js/setup.js b/app/windows/js/setup.js index bad2acf1..5957d3dd 100644 --- a/app/windows/js/setup.js +++ b/app/windows/js/setup.js @@ -120,6 +120,8 @@ var UI = (function(UI, undefined) { settings.lightWallet = 1; settings.lightWalletHost = res[1]; settings.lightWalletPort = res[2]; + settings.lightWalletUser = document.getElementById("light_wallet_user").value; + settings.lightWalletPassword = document.getElementById("light_wallet_password").value; } } diff --git a/ui/js/ui.init.js b/ui/js/ui.init.js index b7fbd00a..6254d6de 100644 --- a/ui/js/ui.init.js +++ b/ui/js/ui.init.js @@ -83,6 +83,14 @@ var UI = (function(UI, $, undefined) { if (params.has("interrupt")) { interruptAttachingToTangle = true; } + + if (params.has("auth_user")) { + connection.auth = { + "type": "basic", + "user": params.get("auth_user"), + "password": params.get("auth_password") + }; + } } UI.makeMultilingual(connection.language, function() { @@ -98,10 +106,15 @@ var UI = (function(UI, $, undefined) { return; } - iota = new IOTA({ - "host": connection.host, - "port": connection.port - }); + var connectionSettings = { + "host": connection.host, + "port": connection.port + }; + if (connection.auth) { + connectionSettings.auth = connection.auth; + } + + iota = new IOTA(connectionSettings); if (connection.host != "http://localhost") { connection.lightWallet = true;