@@ -473,9 +473,9 @@ var UI = (function(UI, undefined) {
473473 select . addEventListener ( "change" , function ( e ) {
474474 e . preventDefault ( ) ;
475475 if ( this . value == "custom" ) {
476- document . getElementById ( "server_config_host " ) . style . display = "none " ;
476+ document . getElementById ( "custom_light_wallet " ) . style . display = "block " ;
477477 } else {
478- document . getElementById ( "server_config_host " ) . style . display = "none" ;
478+ document . getElementById ( "custom_light_wallet " ) . style . display = "none" ;
479479 }
480480 } ) ;
481481 } else {
@@ -500,12 +500,11 @@ var UI = (function(UI, undefined) {
500500 content = "<h1 data-18n='node_config'></h1>" +
501501 "<div class='input-group'><label><span data-i18n='host' class='label'>" + UI . t ( "host" ) + "</span> <span class='error' id='host-error'></span></label>" ;
502502
503+ var found = false ;
503504 if ( configuration . lightWalletHosts && configuration . lightWalletHosts . length ) {
504505 content += "<select id='server_config_host_select'>" ;
505506 content += "<option value='' data-i18n='select_your_host'>" + UI . t ( "select_your_host" ) + "</option>" ;
506507
507- var found = false ;
508-
509508 for ( var i = 0 ; i < configuration . lightWalletHosts . length ; i ++ ) {
510509 var lightWalletHost = configuration . lightWalletHosts [ i ] ;
511510 if ( ! found && ( configuration . lightWalletHost && ( configuration . lightWalletHost + ":" + configuration . lightWalletPort ) == lightWalletHost ) ) {
@@ -517,11 +516,31 @@ var UI = (function(UI, undefined) {
517516 content += "<option value='custom'" + ( ! found ? " selected='selected'" : "" ) + " data-i18n='custom'>" + UI . t ( "custom" ) + "</option>" ;
518517 content += "</select>" ;
519518 content += "<hr />" ;
520- content += "<input type='text' id='server_config_host' placeholder='" + UI . t ( "custom_host" ) + "' data-i18n='[placeholder]custom_host' value='" + ( ! found && configuration . lightWalletHost ? UI . format ( configuration . lightWalletHost ) + ( configuration . lightWalletPort ? ":" + UI . format ( configuration . lightWalletPort ) : "" ) : "" ) + "' " + ( found ? " style='display:none'" : "" ) + " /></div>" ;
521- } else {
522- content += "<input type='text' id='server_config_host' placeholder='" + UI . t ( "custom_host" ) + "' data-i18n='[placeholder]custom_host' value='" + ( configuration . lightWalletHost ? UI . format ( configuration . lightWalletHost ) + ( configuration . lightWalletPort ? ":" + UI . format ( configuration . lightWalletPort ) : "" ) : "" ) + "' /></div>" ;
523519 }
524520
521+ var hostValue = "" ;
522+ if ( ! found && configuration . lightWalletHost ) {
523+ hostValue += UI . format ( configuration . lightWalletHost ) ;
524+ if ( configuration . lightWalletPort ) {
525+ hostValue += ":" + UI . format ( configuration . lightWalletPort ) ;
526+ }
527+ }
528+
529+ var lwUser = configuration . lightWalletUser ? UI . format ( configuration . lightWalletUser ) : '' ;
530+ var lwPassword = configuration . lightWalletPassword ? UI . format ( configuration . lightWalletUPassword ) : '' ;
531+
532+ content += "<div id='custom_light_wallet' style='margin-top: 10px; display:" + ( found ? "none" : "block" ) + ";'>" ;
533+ content += "<input type='text' id='server_config_host' placeholder='" + UI . t ( "custom_host" ) + "' data-i18n='[placeholder]custom_host' value='" + hostValue + "' />" ;
534+ content += "<div class='input-group' style='margin-top: 10px;'>"
535+ + "<label for='light_wallet_user' data-i18n=light_wallet_user'>" + UI . t ( "light_wallet_user" ) + "</label>"
536+ + "<input type='text' name='light_wallet_user' id='light_wallet_user' value='" + lwUser + "' />"
537+ + "</div>" ;
538+ content += "<div class='input-group'>"
539+ + "<label for='light_wallet_password' data-i18n=light_wallet_password'>" + UI . t ( "light_wallet_password" ) + "</label>"
540+ + "<input type='password' name='light_wallet_password' id='light_wallet_password' value='" + lwPassword + "' />"
541+ + "</div>" ;
542+ content += "</div>" ;
543+
525544 content += "<div class='input-group'><label data-i18n='min_weight_magnitude'>" + UI . t ( "min_weight_magnitude" ) + "</label>" +
526545 "<input type='number' min='" + UI . format ( configuration . minWeightMagnitudeMinimum ) + "' name='min_weight_magnitude' id='server_config_min_weight_magnitude' placeholder='' value='" + UI . format ( configuration . minWeightMagnitude ? configuration . minWeightMagnitude : configuration . minWeightMagnitudeMinimum ) + "' /></div>" ;
527546 } else {
@@ -567,10 +586,14 @@ var UI = (function(UI, undefined) {
567586 var selectedHost ;
568587
569588 var select = document . getElementById ( "server_config_host_select" ) ;
589+ var username = "" ;
590+ var password = "" ;
570591 if ( select ) {
571592 var selectedHost = select . options [ select . selectedIndex ] . value ;
572593 if ( selectedHost == "custom" ) {
573594 selectedHost = document . getElementById ( "server_config_host" ) . value ;
595+ username = document . getElementById ( "light_wallet_user" ) . value ;
596+ password = document . getElementById ( "light_wallet_password" ) . value ;
574597 }
575598 } else {
576599 selectedHost = document . getElementById ( "server_config_host" ) . value ;
@@ -586,6 +609,8 @@ var UI = (function(UI, undefined) {
586609
587610 config . lightWalletHost = res [ 1 ] ;
588611 config . lightWalletPort = res [ 2 ] ;
612+ config . lightWalletUser = username ;
613+ config . lightWalletPassword = password ;
589614 config . minWeightMagnitude = parseInt ( document . getElementById ( "server_config_min_weight_magnitude" ) . value , 10 ) ;
590615 } else {
591616 config . port = parseInt ( document . getElementById ( "server_config_port" ) . value , 10 ) ;
0 commit comments