@@ -473,9 +473,9 @@ var UI = (function(UI, undefined) {
473
473
select . addEventListener ( "change" , function ( e ) {
474
474
e . preventDefault ( ) ;
475
475
if ( this . value == "custom" ) {
476
- document . getElementById ( "server_config_host " ) . style . display = "none " ;
476
+ document . getElementById ( "custom_light_wallet " ) . style . display = "block " ;
477
477
} else {
478
- document . getElementById ( "server_config_host " ) . style . display = "none" ;
478
+ document . getElementById ( "custom_light_wallet " ) . style . display = "none" ;
479
479
}
480
480
} ) ;
481
481
} else {
@@ -500,12 +500,11 @@ var UI = (function(UI, undefined) {
500
500
content = "<h1 data-18n='node_config'></h1>" +
501
501
"<div class='input-group'><label><span data-i18n='host' class='label'>" + UI . t ( "host" ) + "</span> <span class='error' id='host-error'></span></label>" ;
502
502
503
+ var found = false ;
503
504
if ( configuration . lightWalletHosts && configuration . lightWalletHosts . length ) {
504
505
content += "<select id='server_config_host_select'>" ;
505
506
content += "<option value='' data-i18n='select_your_host'>" + UI . t ( "select_your_host" ) + "</option>" ;
506
507
507
- var found = false ;
508
-
509
508
for ( var i = 0 ; i < configuration . lightWalletHosts . length ; i ++ ) {
510
509
var lightWalletHost = configuration . lightWalletHosts [ i ] ;
511
510
if ( ! found && ( configuration . lightWalletHost && ( configuration . lightWalletHost + ":" + configuration . lightWalletPort ) == lightWalletHost ) ) {
@@ -517,11 +516,31 @@ var UI = (function(UI, undefined) {
517
516
content += "<option value='custom'" + ( ! found ? " selected='selected'" : "" ) + " data-i18n='custom'>" + UI . t ( "custom" ) + "</option>" ;
518
517
content += "</select>" ;
519
518
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>" ;
523
519
}
524
520
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
+
525
544
content += "<div class='input-group'><label data-i18n='min_weight_magnitude'>" + UI . t ( "min_weight_magnitude" ) + "</label>" +
526
545
"<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>" ;
527
546
} else {
@@ -567,10 +586,14 @@ var UI = (function(UI, undefined) {
567
586
var selectedHost ;
568
587
569
588
var select = document . getElementById ( "server_config_host_select" ) ;
589
+ var username = "" ;
590
+ var password = "" ;
570
591
if ( select ) {
571
592
var selectedHost = select . options [ select . selectedIndex ] . value ;
572
593
if ( selectedHost == "custom" ) {
573
594
selectedHost = document . getElementById ( "server_config_host" ) . value ;
595
+ username = document . getElementById ( "light_wallet_user" ) . value ;
596
+ password = document . getElementById ( "light_wallet_password" ) . value ;
574
597
}
575
598
} else {
576
599
selectedHost = document . getElementById ( "server_config_host" ) . value ;
@@ -586,6 +609,8 @@ var UI = (function(UI, undefined) {
586
609
587
610
config . lightWalletHost = res [ 1 ] ;
588
611
config . lightWalletPort = res [ 2 ] ;
612
+ config . lightWalletUser = username ;
613
+ config . lightWalletPassword = password ;
589
614
config . minWeightMagnitude = parseInt ( document . getElementById ( "server_config_min_weight_magnitude" ) . value , 10 ) ;
590
615
} else {
591
616
config . port = parseInt ( document . getElementById ( "server_config_port" ) . value , 10 ) ;
0 commit comments