diff --git a/app/js/index.js b/app/js/index.js index e311b455..a6dc9124 100644 --- a/app/js/index.js +++ b/app/js/index.js @@ -522,6 +522,16 @@ var UI = (function(UI, undefined) { content += ""; } + content += "
" + + "" + + "" + + "
"; + + content += "
" + + "" + + "" + + "
"; + content += "
" + "
"; } else { @@ -586,6 +596,10 @@ var UI = (function(UI, undefined) { config.lightWalletHost = res[1]; config.lightWalletPort = res[2]; + + config.lightWalletUser = document.getElementById("light_wallet_user").value; + config.lightWalletPassword = document.getElementById("light_wallet_password").value; + config.minWeightMagnitude = parseInt(document.getElementById("server_config_min_weight_magnitude").value, 10); } else { config.port = parseInt(document.getElementById("server_config_port").value, 10); diff --git a/app/js/main.js b/app/js/main.js index e19c0713..db288697 100644 --- a/app/js/main.js +++ b/app/js/main.js @@ -1539,6 +1539,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, @@ -1974,7 +1976,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 = http.get('http://provider.iota.org/list.json?' + (new Date().getTime())); req.on('response', function (res) { @@ -2063,6 +2074,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 03b57067..d002b1c7 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/locales/en/translation.json b/locales/en/translation.json index f7a70bf2..ccceab3f 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -289,5 +289,8 @@ "russian":"Russian", "swedish":"Swedish", "korean":"Korean", - "seed":"Seed" + "seed":"Seed", + + "light_wallet_user":"Username", + "light_wallet_password": "Password" } \ No newline at end of file diff --git a/ui/js/ui.init.js b/ui/js/ui.init.js index 7e88ead8..4ff730e8 100644 --- a/ui/js/ui.init.js +++ b/ui/js/ui.init.js @@ -80,6 +80,14 @@ var UI = (function(UI, $, undefined) { if (params.has("allowShortSeedLogin")) { connection.allowShortSeedLogin = params.get("allowShortSeedLogin") == 1; } + + if (params.has("auth_user")) { + connection.auth = { + "type": "basic", + "user": params.get("auth_user"), + "password": params.get("auth_password") + }; + } } UI.makeMultilingual(connection.language, function() { @@ -95,10 +103,15 @@ var UI = (function(UI, $, undefined) { return; } - iota = new IOTA({ + 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;