Updating ethoFS Login System
This commit is contained in:
@@ -50,6 +50,7 @@ var GlobalControllerABI = JSON.parse('[ { "constant": true, "inputs": [], "name"
|
|||||||
const $miningMessage = document.querySelector('.mining-message')
|
const $miningMessage = document.querySelector('.mining-message')
|
||||||
|
|
||||||
/*START OF MISC GLOBAL VARIABLES*/
|
/*START OF MISC GLOBAL VARIABLES*/
|
||||||
|
var web3;
|
||||||
var privateKeyLogin = false;
|
var privateKeyLogin = false;
|
||||||
var GlobalPrivateKey;
|
var GlobalPrivateKey;
|
||||||
var minimumContractCost = 10000000000000000;
|
var minimumContractCost = 10000000000000000;
|
||||||
@@ -74,9 +75,9 @@ var GlobalHostingContractDetailArray = new Array();
|
|||||||
var GlobalExtensionDuration;
|
var GlobalExtensionDuration;
|
||||||
/*END OF MISC GLOBAL VARIABLES*/
|
/*END OF MISC GLOBAL VARIABLES*/
|
||||||
|
|
||||||
var elem = document.querySelector('.modal');
|
//var elem = document.querySelector('.modal');
|
||||||
var instance = M.Modal.init(elem);
|
//var instance = M.Modal.init(elem);
|
||||||
instance.open();
|
//instance.open();
|
||||||
|
|
||||||
function isWindows() {
|
function isWindows() {
|
||||||
return navigator.platform.indexOf('Win') > -1
|
return navigator.platform.indexOf('Win') > -1
|
||||||
@@ -94,18 +95,40 @@ fetch('https://api.coinmarketcap.com/v2/ticker/3452/').then(response => {
|
|||||||
document.getElementById("ethoprice").textContent = round(ethoPriceUSD, 4);
|
document.getElementById("ethoprice").textContent = round(ethoPriceUSD, 4);
|
||||||
}).catch(err => {});
|
}).catch(err => {});
|
||||||
|
|
||||||
if (typeof web3 == 'undefined') {
|
function beforeLoginState() {
|
||||||
var web3 = new Web3()
|
var statsRow = document.getElementById("stats-row");
|
||||||
|
statsRow.style.display = "none";
|
||||||
|
var uploadButton = document.getElementById("main-upload-button");
|
||||||
|
uploadButton.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
function afterLoginState() {
|
||||||
|
var statsRow = document.getElementById("stats-row");
|
||||||
|
statsRow.style.display = "block";
|
||||||
|
var uploadButton = document.getElementById("main-upload-button");
|
||||||
|
uploadButton.style.display = "block";
|
||||||
|
var loginButton = document.getElementById("main-login-button");
|
||||||
|
loginButton.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkLogin() {
|
||||||
|
if (web3 == null) {
|
||||||
|
beforeLoginState();
|
||||||
|
web3 = new Web3()
|
||||||
web3.setProvider(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
|
web3.setProvider(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
|
||||||
$('#ethofsLoginModal').modal({dismissible: true});
|
//$('#ethofsLoginModal').modal({dismissible: true});
|
||||||
$('#ethofsLoginModal').modal('open');
|
//$('#ethofsLoginModal').modal('show');
|
||||||
} else {
|
} else {
|
||||||
ethofsLogin("");
|
ethofsLogin(GlobalPrivateKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ethofsLogin(privateKey) {
|
function ethofsLogin(privateKey) {
|
||||||
|
afterLoginState();
|
||||||
$('#ethofsLoginModal').modal('close');
|
$('#ethofsLoginModal').modal('close');
|
||||||
$('#ethofsRegistrationModal').modal({dismissible: true});
|
$('#ethofsRegistrationModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#ethofsRegistrationModal').modal('close');
|
$('#ethofsRegistrationModal').modal('close');
|
||||||
//CREATE ETHER-1 CHAIN CONNECTION AND LOOK FOR EXISTING USER ACCOUNT
|
//CREATE ETHER-1 CHAIN CONNECTION AND LOOK FOR EXISTING USER ACCOUNT
|
||||||
if (privateKey != "") {
|
if (privateKey != "") {
|
||||||
@@ -196,7 +219,9 @@ function AddNewUser(userName) {
|
|||||||
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
$('#minedBlockTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#minedBlockTrackerModal').modal('open');
|
$('#minedBlockTrackerModal').modal('open');
|
||||||
waitForReceipt(result, function (receipt) {
|
waitForReceipt(result, function (receipt) {
|
||||||
console.log("Transaction Has Been Mined: " + receipt);
|
console.log("Transaction Has Been Mined: " + receipt);
|
||||||
@@ -306,7 +331,9 @@ function RemoveContract(hostingAddress, contentHash) {
|
|||||||
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
$('#minedBlockTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#minedBlockTrackerModal').modal('open');
|
$('#minedBlockTrackerModal').modal('open');
|
||||||
waitForReceipt(result, function (receipt) {
|
waitForReceipt(result, function (receipt) {
|
||||||
console.log("Transaction Has Been Mined: " + receipt);
|
console.log("Transaction Has Been Mined: " + receipt);
|
||||||
@@ -329,7 +356,9 @@ function RemoveContract(hostingAddress, contentHash) {
|
|||||||
pinRemoving.methods.RemoveHostingContract(hostingAddress, contentHash).send(tx, function (error, result) {
|
pinRemoving.methods.RemoveHostingContract(hostingAddress, contentHash).send(tx, function (error, result) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
$('#minedBlockTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#minedBlockTrackerModal').modal('open');
|
$('#minedBlockTrackerModal').modal('open');
|
||||||
waitForReceipt(result, function (receipt) {
|
waitForReceipt(result, function (receipt) {
|
||||||
console.log("Transaction Has Been Mined: " + receipt);
|
console.log("Transaction Has Been Mined: " + receipt);
|
||||||
@@ -477,7 +506,9 @@ function round(value, decimals) {
|
|||||||
}
|
}
|
||||||
/*************************************************************************************************************/
|
/*************************************************************************************************************/
|
||||||
function finishUploadModal() {
|
function finishUploadModal() {
|
||||||
$('#uploadTrackerModal').modal({dismissible: true});
|
$('#uploadTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#uploadTrackerModal').modal('close');
|
$('#uploadTrackerModal').modal('close');
|
||||||
stopApplication();
|
stopApplication();
|
||||||
resetUploadSystem();
|
resetUploadSystem();
|
||||||
@@ -497,7 +528,9 @@ function resetUploadModal() {
|
|||||||
//CHECK FOR PROPAGATED & AVAILABLE DATA ON NETWORK - FINAL VERIFICATION FOR UPLOADED CONTENT
|
//CHECK FOR PROPAGATED & AVAILABLE DATA ON NETWORK - FINAL VERIFICATION FOR UPLOADED CONTENT
|
||||||
function checkForUploadedContentAvailability(HostingContractName) {
|
function checkForUploadedContentAvailability(HostingContractName) {
|
||||||
document.getElementById("upload-check-button").style.visibility = "hidden";
|
document.getElementById("upload-check-button").style.visibility = "hidden";
|
||||||
$('#uploadTrackerModal').modal({dismissible: true});
|
$('#uploadTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#uploadTrackerModal').modal('open');
|
$('#uploadTrackerModal').modal('open');
|
||||||
document.getElementById("upload-hash").innerHTML = HostingContractName;
|
document.getElementById("upload-hash").innerHTML = HostingContractName;
|
||||||
return false;
|
return false;
|
||||||
@@ -608,7 +641,9 @@ function showHostingContractDetails(counter) {
|
|||||||
resetContractExtensionChange();
|
resetContractExtensionChange();
|
||||||
|
|
||||||
GlobalHostingContractDetailArray = GlobalHostingContractArray[counter];
|
GlobalHostingContractDetailArray = GlobalHostingContractArray[counter];
|
||||||
$('#contractDetailModal').modal({dismissible: true});
|
$('#contractDetailModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#contractDetailModal').modal('open');
|
$('#contractDetailModal').modal('open');
|
||||||
document.getElementById("contract-detail-name").innerHTML = GlobalHostingContractDetailArray['name'];
|
document.getElementById("contract-detail-name").innerHTML = GlobalHostingContractDetailArray['name'];
|
||||||
var hashOutputString = "";
|
var hashOutputString = "";
|
||||||
@@ -693,9 +728,13 @@ function contractExtensionConfirmation() {
|
|||||||
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
$('#contractDetailModal').modal({dismissible: true});
|
$('#contractDetailModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#contractDetailModal').modal('close');
|
$('#contractDetailModal').modal('close');
|
||||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
$('#minedBlockTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#minedBlockTrackerModal').modal('open');
|
$('#minedBlockTrackerModal').modal('open');
|
||||||
waitForReceipt(result, function (receipt) {
|
waitForReceipt(result, function (receipt) {
|
||||||
console.log("Transaction Has Been Mined: " + receipt);
|
console.log("Transaction Has Been Mined: " + receipt);
|
||||||
@@ -886,7 +925,9 @@ const onDragLeave = () => $dragContainer.classList.remove('dragging')
|
|||||||
|
|
||||||
function startUploadProcess() {
|
function startUploadProcess() {
|
||||||
console.log("Starting Upload Process..");
|
console.log("Starting Upload Process..");
|
||||||
$('#preparingUploadModal').modal({dismissible: true});
|
$('#preparingUploadModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#preparingUploadModal').modal('open');
|
$('#preparingUploadModal').modal('open');
|
||||||
var streamFinishCount = 0;
|
var streamFinishCount = 0;
|
||||||
for (var i = 0; i < MainFileArray.length; i++) {
|
for (var i = 0; i < MainFileArray.length; i++) {
|
||||||
@@ -1040,15 +1081,23 @@ function startUploadProcess() {
|
|||||||
if (!error) {
|
if (!error) {
|
||||||
if (result) {
|
if (result) {
|
||||||
console.log("Result: " + result);
|
console.log("Result: " + result);
|
||||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
$('#minedBlockTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#minedBlockTrackerModal').modal('open');
|
$('#minedBlockTrackerModal').modal('open');
|
||||||
$('#preparingUploadModal').modal({dismissible: true});
|
$('#preparingUploadModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#preparingUploadModal').modal('close');
|
$('#preparingUploadModal').modal('close');
|
||||||
waitForReceipt(result, function (receipt) {
|
waitForReceipt(result, function (receipt) {
|
||||||
console.log("Transaction Has Been Mined: " + receipt);
|
console.log("Transaction Has Been Mined: " + receipt);
|
||||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
$('#minedBlockTrackerModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#minedBlockTrackerModal').modal('close');
|
$('#minedBlockTrackerModal').modal('close');
|
||||||
$('#nodeModal').modal({dismissible: true});
|
$('#nodeModal').modal({
|
||||||
|
dismissible: true
|
||||||
|
});
|
||||||
$('#nodeModal').modal('close');
|
$('#nodeModal').modal('close');
|
||||||
var filesForStream = MainFileArray;
|
var filesForStream = MainFileArray;
|
||||||
streamFilesExternally(filesForStream, MainHashArray);
|
streamFilesExternally(filesForStream, MainHashArray);
|
||||||
|
|||||||
@@ -27,14 +27,15 @@
|
|||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="block-header">
|
<div class="block-header">
|
||||||
<h2>DASHBOARD -
|
<h2>
|
||||||
<span id="accountaddress" style="word-break: break-word;"></span> -
|
<span id="accountaddress" style="word-break: break-word;"></span>
|
||||||
<span id="welcome-name"></span>
|
<span id="welcome-name">
|
||||||
|
</span>
|
||||||
<span id="ethobalance"></span>
|
<span id="ethobalance"></span>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<!-- Widgets -->
|
<!-- Widgets -->
|
||||||
<div class="row clearfix">
|
<div class="row clearfix" id="stats-row">
|
||||||
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
|
||||||
<div class="info-box bg-pink hover-expand-effect">
|
<div class="info-box bg-pink hover-expand-effect">
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
@@ -127,9 +128,13 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<center>
|
<center>
|
||||||
<button type="button" class="btn bg-indigo waves-effect" data-toggle="modal" data-target="#defaultModal" onclick="resetUploadProcess();">
|
<button type="button" class="btn bg-indigo waves-effect" id="main-upload-button" data-toggle="modal" data-target="#defaultModal" onclick="resetUploadProcess();">
|
||||||
<i class="material-icons">cloud_upload</i>
|
<i class="material-icons">cloud_upload</i>
|
||||||
<span>Upload to ethoFS now</span>
|
<span>Upload to ethoFS</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn bg-indigo waves-effect" id="main-login-button" data-toggle="modal" data-target="#ethofsLoginModal" onclick="checkLogin();">
|
||||||
|
<i class="material-icons">fingerprint</i>
|
||||||
|
<span>Login To ethoFS</span>
|
||||||
</button>
|
</button>
|
||||||
</center>
|
</center>
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
@@ -386,7 +391,7 @@
|
|||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">CLOSE</button>
|
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal" id="upload-confirm-button" onclick="startUploadProcess();">CONFIRM</button>
|
<button type="button" class="btn btn-link waves-effect" data-dismiss="modal" id="upload-confirm-button" data-target="#preparingUploadModal" onclick="startUploadProcess();">CONFIRM</button>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
@@ -692,11 +697,14 @@
|
|||||||
<script src="assets/dashboard/plugins/jquery-countto/jquery.countTo.js"></script>
|
<script src="assets/dashboard/plugins/jquery-countto/jquery.countTo.js"></script>
|
||||||
<!-- Custom Js -->
|
<!-- Custom Js -->
|
||||||
<script src="assets/dashboard/js/admin.js"></script>
|
<script src="assets/dashboard/js/admin.js"></script>
|
||||||
<script src="assets/dashboard/js/bundle.js"></script>
|
|
||||||
<script src="assets/dashboard/js/app.js"></script>
|
<script src="assets/dashboard/js/app.js"></script>
|
||||||
|
<script src="assets/dashboard/js/bundle.js"></script>
|
||||||
<!-- Demo Js -->
|
<!-- Demo Js -->
|
||||||
<script src="assets/dashboard/js/demo.js"></script>
|
<script src="assets/dashboard/js/demo.js"></script>
|
||||||
<script src="assets/dashboard/js/medium.js"></script>
|
<script src="assets/dashboard/js/medium.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
checkLogin();
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
MediumWidget.Init({
|
MediumWidget.Init({
|
||||||
renderTo: '#medium-widget',
|
renderTo: '#medium-widget',
|
||||||
|
|||||||
Reference in New Issue
Block a user