Browse Source

Login page updated with some changes to add coin

master
Satinder Grewal 8 years ago
parent
commit
2e968b6cc0
  1. 3
      assets/scripts/dashboard.js
  2. 68
      assets/scripts/iguana_api.js
  3. 27
      assets/scripts/login.js
  4. 89
      index.html

3
assets/scripts/dashboard.js

@ -303,12 +303,9 @@ var Dashboard = function() {
} }
var handleWalletWidgetBtns = function() { var handleWalletWidgetBtns = function() {
$('.mdl_addcoin_done_btn').click(function(){ $('.mdl_addcoin_done_btn').click(function(){
ExecuteAddCoinFn(); ExecuteAddCoinFn();
}); });
} }

68
assets/scripts/iguana_api.js

@ -359,10 +359,16 @@ function Iguana_addcoin(addcoin_data) {
Iguana_Setactivehandle(); Iguana_Setactivehandle();
console.log('coin added'); console.log('coin added');
toastr.success(logincoinfullname+" started in "+ logincoinmodeinfo +" Mode", "Coin Notification"); toastr.success(logincoinfullname+" started in "+ logincoinmodeinfo +" Mode", "Coin Notification");
//if ( typeof addcoin_data.reload == 'undefined' || addcoin_data.reload != false ) { if (addcoin_data.logincmd == undefined) {
//$(document).ready(function() { Dashboard.init(); }); console.log('command NOT executed from login. RELOADING SCREEN...');
$(document).ready(function() { window.location.reload(); }); $(document).ready(function() { window.location.reload(); });
//} } else {
var check_active_coins_status = Iguana_CheckActiveCoins()
if (check_active_coins_status.length !== 0 ) {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
}
}
} else if (addcoinData.result === 'coin already there') { } else if (addcoinData.result === 'coin already there') {
console.log('coin already there'); console.log('coin already there');
toastr.info("Looks like "+ logincoinfullname +" already running.", "Coin Notification"); toastr.info("Looks like "+ logincoinfullname +" already running.", "Coin Notification");
@ -389,6 +395,13 @@ function ExecuteAddCoinFn() {
Iguana_addcoin(ExecAddCoinData); Iguana_addcoin(ExecAddCoinData);
} }
function ExecuteAddCoinLoginFn() {
var addcoin_selected_mode_val = $("input[name='addcoin_select_mode_mdl-login']:checked").val();
var addcoin_selected_coinname_code_val = $("option:selected","#addcoin_select_coin_mdl_options-login").val();
var ExecAddCoinData = {"coin": addcoin_selected_coinname_code_val, "mode": addcoin_selected_mode_val, "logincmd": 1}
Iguana_addcoin(ExecAddCoinData);
}
function Iguana_ServiceUnavailable() { function Iguana_ServiceUnavailable() {
console.log('Network Error with history api'); console.log('Network Error with history api');
toastr.error("Unable to connect with iguana service. 127.0.0.1:7778", "Service Notification") toastr.error("Unable to connect with iguana service. 127.0.0.1:7778", "Service Notification")
@ -704,3 +717,52 @@ function Iguana_SetRPCAuth() {
var tmpPass = md5(PassPhraseGenerator.generatePassPhrase(128)); var tmpPass = md5(PassPhraseGenerator.generatePassPhrase(128));
sessionStorage.setItem('IguanaRPCAuth', tmpPass); sessionStorage.setItem('IguanaRPCAuth', tmpPass);
} }
function Iguana_CheckActiveCoins() {
var result = [];
//Get parameters values from confirm dialog and send currency
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"InstantDEX","method":"allcoins"};
console.log(ajax_data);
$.ajax({
async: false,
type: 'POST',
data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:7778',
//dataType: 'text',
success: function(data, textStatus, jqXHR) {
var AjaxOutputData = JSON.parse(data);
//console.log('== Data OutPut ==');
//console.log(AjaxOutputData);
$.each(AjaxOutputData, function( index, value ) {
//console.log(index)
//console.log(value)
if (index === 'tag' ) {
//console.log('it is tag');
} else {
if (AjaxOutputData[index].length !== 0 ) {
result.push({"active": AjaxOutputData[index].length});
}
//console.log(AjaxOutputData[index]);
//console.log(AjaxOutputData[index].length);
}
});
},
error: function(xhr, textStatus, error) {
console.log(xhr.statusText);
if ( xhr.readyState == 0 ) {
Iguana_ServiceUnavailable();
}
console.log(textStatus);
console.log(error);
}
});
return result;
}

27
assets/scripts/login.js

@ -385,6 +385,8 @@ var Login = function() {
var handleLogout = function() { var handleLogout = function() {
$('#logout-account').click(function() { $('#logout-account').click(function() {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth'); var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"} var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"}
$.ajax({ $.ajax({
@ -454,6 +456,8 @@ var Login = function() {
var handleLock = function() { var handleLock = function() {
//Begin Lock Active Wallet //Begin Lock Active Wallet
$('#lock-screen').click(function() { $('#lock-screen').click(function() {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth'); var tmpIguanaRPCAuth = 'tmpIgRPCUser@'+sessionStorage.getItem('IguanaRPCAuth');
var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"} var ajax_data = {'userpass':tmpIguanaRPCAuth,"agent":"bitcoinrpc","method":"walletlock"}
$.ajax({ $.ajax({
@ -551,6 +555,11 @@ var Login = function() {
if ( sessionStorage.getItem('IguanaActiveAccount') === null ) { if ( sessionStorage.getItem('IguanaActiveAccount') === null ) {
console.log('There\'s no active wallet logged in. Please Login.'); console.log('There\'s no active wallet logged in. Please Login.');
$('#logint-another-wallet').hide(); $('#logint-another-wallet').hide();
var check_active_coins_status = Iguana_CheckActiveCoins()
if (check_active_coins_status.length !== 0 ) {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
}
} else { } else {
var CheckLoginData = JSON.parse(sessionStorage.getItem('IguanaActiveAccount')); var CheckLoginData = JSON.parse(sessionStorage.getItem('IguanaActiveAccount'));
if ( JSON.parse(CheckLoginData).pubkey != Iguana_activehandle_output.pubkey ) { if ( JSON.parse(CheckLoginData).pubkey != Iguana_activehandle_output.pubkey ) {
@ -570,6 +579,8 @@ var Login = function() {
$('#login-welcome').text('Wallet Locked. Please login'); $('#login-welcome').text('Wallet Locked. Please login');
$('#register-btn').hide(); $('#register-btn').hide();
$("#loginbtn").text('Unlock'); $("#loginbtn").text('Unlock');
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
} }
} }
if ( sessionStorage.getItem('IguanaRPCAuth') === null || typeof sessionStorage.getItem('IguanaRPCAuth') == undefined) { if ( sessionStorage.getItem('IguanaRPCAuth') === null || typeof sessionStorage.getItem('IguanaRPCAuth') == undefined) {
@ -583,6 +594,11 @@ var Login = function() {
}; };
var handleCoinsRunningCheck = function() { var handleCoinsRunningCheck = function() {
var check_active_coins_status = Iguana_CheckActiveCoins()
if (check_active_coins_status.length !== 0 ) {
$('#section-login-addcoin-btn').hide();
$('#section-login').show();
}
/*$.each([ 'basilisk', 'full', 'virtual' ], function( index, value ) { /*$.each([ 'basilisk', 'full', 'virtual' ], function( index, value ) {
var allcoinsvalues = {"agent":"InstantDEX","method":"allcoins"}; var allcoinsvalues = {"agent":"InstantDEX","method":"allcoins"};
@ -731,6 +747,16 @@ var Login = function() {
}); });
}; };
var handleAddCoinLoginBtn = function() {
$('.mdl_addcoin_done_btn-login').click(function(){
ExecuteAddCoinLoginFn();
});
}
return { return {
//main function to initiate the module //main function to initiate the module
init: function() { init: function() {
@ -742,6 +768,7 @@ var Login = function() {
handleLogout(); handleLogout();
handleCheckLogin(); handleCheckLogin();
handleLoginAnotherWallet(); handleLoginAnotherWallet();
handleAddCoinLoginBtn();
} }

89
index.html

@ -110,7 +110,7 @@
</div> </div>
<!-- END IE Warning --> <!-- END IE Warning -->
<!-- BEGIN section login --> <!-- BEGIN section login -->
<div id="section-login"> <div id="section-login" style="display: none;">
<h4 style="color: #fff;" id="login-welcome">Welcome. Please login.</h4> <h4 style="color: #fff;" id="login-welcome">Welcome. Please login.</h4>
<form class="login-form" method="post" action="javascript:;" autocomplete="off" onsubmit="return false;"> <form class="login-form" method="post" action="javascript:;" autocomplete="off" onsubmit="return false;">
<div class="form-group form-material floating"> <div class="form-group form-material floating">
@ -123,9 +123,9 @@
<button class="btn btn-lg btn-flat btn-block waves-effect" id="logint-another-wallet">Login to another wallet</button> <button class="btn btn-lg btn-flat btn-block waves-effect" id="logint-another-wallet">Login to another wallet</button>
</div> </div>
<!-- START ADVANCED OPTIONS TO SELECT COINS --> <!-- START ADVANCED OPTIONS TO SELECT COINS -->
<div class="form-group form-material row" id="logincoinslist"> <!--<div class="form-group form-material row" id="logincoinslist">-->
<!-- START BITCOIN COIN OPTIONS --> <!-- START BITCOIN COIN OPTIONS -->
<div class="col-sm-12"> <!--<div class="col-sm-12">
<div class="col-sm-3"> <div class="col-sm-3">
<div class="checkbox-custom checkbox-default" style="margin-top: 0px; text-align: left;"> <div class="checkbox-custom checkbox-default" style="margin-top: 0px; text-align: left;">
<input type="checkbox" id="logincoinbtc" value="BTC" name="logincoinbtc" checked="" autocomplete="off"> <input type="checkbox" id="logincoinbtc" value="BTC" name="logincoinbtc" checked="" autocomplete="off">
@ -144,10 +144,10 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>-->
<!-- END BITCOIN COIN OPTIONS --> <!-- END BITCOIN COIN OPTIONS -->
<!-- START BITCOIN COIN OPTIONS --> <!-- START BITCOIN COIN OPTIONS -->
<div class="col-sm-12"> <!--<div class="col-sm-12">
<div class="col-sm-3"> <div class="col-sm-3">
<div class="checkbox-custom checkbox-default" style="margin-top: 0px; text-align: left;"> <div class="checkbox-custom checkbox-default" style="margin-top: 0px; text-align: left;">
<input type="checkbox" id="logincoinbtcd" value="BTCD" name="logincoinbtcd" checked="" autocomplete="off"> <input type="checkbox" id="logincoinbtcd" value="BTCD" name="logincoinbtcd" checked="" autocomplete="off">
@ -166,10 +166,10 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>-->
<!-- END BITCOIN COIN OPTIONS --> <!-- END BITCOIN COIN OPTIONS -->
<!-- START BITCOIN COIN OPTIONS --> <!-- START BITCOIN COIN OPTIONS -->
<div class="col-sm-12"> <!--<div class="col-sm-12">
<div class="col-sm-3"> <div class="col-sm-3">
<div class="checkbox-custom checkbox-default" style="margin-top: 0px; text-align: left;"> <div class="checkbox-custom checkbox-default" style="margin-top: 0px; text-align: left;">
<input type="checkbox" id="logincoinkmd" value="KMD" name="logincoinkmd" checked="" autocomplete="off"> <input type="checkbox" id="logincoinkmd" value="KMD" name="logincoinkmd" checked="" autocomplete="off">
@ -188,16 +188,24 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>-->
<!-- END BITCOIN COIN OPTIONS --> <!-- END BITCOIN COIN OPTIONS -->
</div> <!--</div>-->
<!-- END ADVANCED OPTIONS TO SELECT COINS --> <!-- END ADVANCED OPTIONS TO SELECT COINS -->
</form> </form>
</div> </div>
<!-- END section login --> <!-- END section login -->
<!-- BEGIN section login add coin -->
<div id="section-login-addcoin-btn">
<h4 style="color: #fff;" id="login-welcome">Welcome. Please add coin to start.</h4>
<div class="form-group form-material floating" style="width: 540px; margin: 30px 0;">
<button class="btn btn-lg btn-primary btn-block" id="start-coin-login" href="javascript:void(0)" role="menuitem" data-edexcoinmenu="COIN" data-target="#AddCoinDilogModel-login" data-toggle="modal">Start Coin</button>
</div>
<!-- END section login add coin -->
<!-- BEGIN section register --> <!-- BEGIN section register -->
<div id="section-register" style="display: none;"> <div id="section-register" style="display: none;">
<form class="register-form" method="post" role="form" autocomplete="off" onsubmit="return false;"> <form class="register-form" method="post" role="form" autocomplete="off" onsubmit="return false;">
@ -243,6 +251,56 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Modal -->
<div class="modal fade modal-3d-sign" id="AddCoinDilogModel-login" aria-hidden="true" aria-labelledby="AddCoinDilogModel-login" role="dialog" tabindex="-1">
<div class="modal-dialog modal-center modal-lg">
<div class="modal-content">
<div class="modal-header bg-orange-a400 wallet-send-header">
<button type="button" class="close white" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title white">Select Coin to add to EasyDEX</h4>
</div>
<div class="modal-body">
<div class="col-sm-6" style="text-align: center;">
<div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
<input type="radio" class="to-labelauty labelauty" name="addcoin_select_mode_mdl-login" data-plugin="labelauty" id="addcoin_mdl_full_mode" data-labelauty="Full Mode|Full Mode" value="1" checked>
</div>
<div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-6">
<input type="radio" class="to-labelauty labelauty" name="addcoin_select_mode_mdl-login" data-plugin="labelauty" id="addcoin_mdl_basilisk_mode" value="0" data-labelauty="Basilisk Mode|Basilisk Mode">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<select class="form-control form-material" id="addcoin_select_coin_mdl_options-login">
<option>-Select-</option>
<option value="BTC">Bitcoin</option>
<option value="BTCD">BitcoinDark</option>
<option value="KMD">Komodo</option>
</select>
</div>
</div>
<div class="col-sm-2" style="text-align: center;">
<button type="button" class="btn btn-primary mdl_addcoin_done_btn-login" data-toggle="modal" data-dismiss="modal" id="mdl_addcoin_done_btn-login">Add Coin</button>
</div>
<div class="col-sm-12" style="color: #333">
<p><strong>Full Mode:</strong> Adding a coin in Full mode will download FULL blockchain on your local machine. This is the most optimem performing mode, but will require good system performance to have one or multiple coins running in Full mode on your local machine.</p>
<p><strong>Basilisk Mode:</strong> In Basilisk Mode a coin will not donload Full blockchain on local machine. This mode is best if you have less disk space on your machine, or in case your system is low performance system. But, it will be bit low in performance as compare to Full mode.</p>
<p><strong>Native Mode:</strong> This mode is ONLY available for KOMODO Coin, PAX FIAT Chains, Assetchains, and Geckochains. This mode uses <strong>Komodo Daemon</strong>, instead of <i>Iguana Daemon</i> to query blockchain data.</p>
<div class="alert alert-icon alert-primary" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<i class="icon md-info-outline" aria-hidden="true"></i> <strong>Native Mode</strong> is the so far mode which will allow you to do <strong>Z Transactions</strong>, the <i>Private Transactions</i>.
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Modal -->
</div>
<!-- START ADD COIN DIV -->
<!-- END Login Page --> <!-- END Login Page -->
@ -814,6 +872,15 @@
<div class="col-sm-2" style="text-align: center;"> <div class="col-sm-2" style="text-align: center;">
<button type="button" class="btn btn-primary mdl_addcoin_done_btn" data-toggle="modal" data-dismiss="modal" id="mdl_addcoin_done_btn">Add Coin</button> <button type="button" class="btn btn-primary mdl_addcoin_done_btn" data-toggle="modal" data-dismiss="modal" id="mdl_addcoin_done_btn">Add Coin</button>
</div> </div>
<div class="col-sm-12" style="color: #333">
<p><strong>Full Mode:</strong> Adding a coin in Full mode will download FULL blockchain on your local machine. This is the most optimem performing mode, but will require good system performance to have one or multiple coins running in Full mode on your local machine.</p>
<p><strong>Basilisk Mode:</strong> In Basilisk Mode a coin will not donload Full blockchain on local machine. This mode is best if you have less disk space on your machine, or in case your system is low performance system. But, it will be bit low in performance as compare to Full mode.</p>
<p><strong>Native Mode:</strong> This mode is ONLY available for KOMODO Coin, PAX FIAT Chains, Assetchains, and Geckochains. This mode uses <strong>Komodo Daemon</strong>, instead of <i>Iguana Daemon</i> to query blockchain data.</p>
<div class="alert alert-icon alert-primary" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<i class="icon md-info-outline" aria-hidden="true"></i> <strong>Native Mode</strong> is the so far mode which will allow you to do <strong>Z Transactions</strong>, the <i>Private Transactions</i>.
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save