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')
|
||||
|
||||
/*START OF MISC GLOBAL VARIABLES*/
|
||||
var web3;
|
||||
var privateKeyLogin = false;
|
||||
var GlobalPrivateKey;
|
||||
var minimumContractCost = 10000000000000000;
|
||||
@@ -74,9 +75,9 @@ var GlobalHostingContractDetailArray = new Array();
|
||||
var GlobalExtensionDuration;
|
||||
/*END OF MISC GLOBAL VARIABLES*/
|
||||
|
||||
var elem = document.querySelector('.modal');
|
||||
var instance = M.Modal.init(elem);
|
||||
instance.open();
|
||||
//var elem = document.querySelector('.modal');
|
||||
//var instance = M.Modal.init(elem);
|
||||
//instance.open();
|
||||
|
||||
function isWindows() {
|
||||
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);
|
||||
}).catch(err => {});
|
||||
|
||||
if (typeof web3 == 'undefined') {
|
||||
var web3 = new Web3()
|
||||
function beforeLoginState() {
|
||||
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"));
|
||||
$('#ethofsLoginModal').modal({dismissible: true});
|
||||
$('#ethofsLoginModal').modal('open');
|
||||
//$('#ethofsLoginModal').modal({dismissible: true});
|
||||
//$('#ethofsLoginModal').modal('show');
|
||||
} else {
|
||||
ethofsLogin("");
|
||||
ethofsLogin(GlobalPrivateKey);
|
||||
}
|
||||
}
|
||||
|
||||
function ethofsLogin(privateKey) {
|
||||
afterLoginState();
|
||||
$('#ethofsLoginModal').modal('close');
|
||||
$('#ethofsRegistrationModal').modal({dismissible: true});
|
||||
$('#ethofsRegistrationModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#ethofsRegistrationModal').modal('close');
|
||||
//CREATE ETHER-1 CHAIN CONNECTION AND LOOK FOR EXISTING USER ACCOUNT
|
||||
if (privateKey != "") {
|
||||
@@ -196,7 +219,9 @@ function AddNewUser(userName) {
|
||||
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
||||
if (!error) {
|
||||
if (result) {
|
||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
||||
$('#minedBlockTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#minedBlockTrackerModal').modal('open');
|
||||
waitForReceipt(result, function (receipt) {
|
||||
console.log("Transaction Has Been Mined: " + receipt);
|
||||
@@ -306,7 +331,9 @@ function RemoveContract(hostingAddress, contentHash) {
|
||||
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
||||
if (!error) {
|
||||
if (result) {
|
||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
||||
$('#minedBlockTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#minedBlockTrackerModal').modal('open');
|
||||
waitForReceipt(result, function (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) {
|
||||
if (!error) {
|
||||
if (result) {
|
||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
||||
$('#minedBlockTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#minedBlockTrackerModal').modal('open');
|
||||
waitForReceipt(result, function (receipt) {
|
||||
console.log("Transaction Has Been Mined: " + receipt);
|
||||
@@ -477,7 +506,9 @@ function round(value, decimals) {
|
||||
}
|
||||
/*************************************************************************************************************/
|
||||
function finishUploadModal() {
|
||||
$('#uploadTrackerModal').modal({dismissible: true});
|
||||
$('#uploadTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#uploadTrackerModal').modal('close');
|
||||
stopApplication();
|
||||
resetUploadSystem();
|
||||
@@ -497,7 +528,9 @@ function resetUploadModal() {
|
||||
//CHECK FOR PROPAGATED & AVAILABLE DATA ON NETWORK - FINAL VERIFICATION FOR UPLOADED CONTENT
|
||||
function checkForUploadedContentAvailability(HostingContractName) {
|
||||
document.getElementById("upload-check-button").style.visibility = "hidden";
|
||||
$('#uploadTrackerModal').modal({dismissible: true});
|
||||
$('#uploadTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#uploadTrackerModal').modal('open');
|
||||
document.getElementById("upload-hash").innerHTML = HostingContractName;
|
||||
return false;
|
||||
@@ -608,7 +641,9 @@ function showHostingContractDetails(counter) {
|
||||
resetContractExtensionChange();
|
||||
|
||||
GlobalHostingContractDetailArray = GlobalHostingContractArray[counter];
|
||||
$('#contractDetailModal').modal({dismissible: true});
|
||||
$('#contractDetailModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#contractDetailModal').modal('open');
|
||||
document.getElementById("contract-detail-name").innerHTML = GlobalHostingContractDetailArray['name'];
|
||||
var hashOutputString = "";
|
||||
@@ -693,9 +728,13 @@ function contractExtensionConfirmation() {
|
||||
web3.eth.sendSignedTransaction(signedTransactionData.rawTransaction, function (error, result) {
|
||||
if (!error) {
|
||||
if (result) {
|
||||
$('#contractDetailModal').modal({dismissible: true});
|
||||
$('#contractDetailModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#contractDetailModal').modal('close');
|
||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
||||
$('#minedBlockTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#minedBlockTrackerModal').modal('open');
|
||||
waitForReceipt(result, function (receipt) {
|
||||
console.log("Transaction Has Been Mined: " + receipt);
|
||||
@@ -886,7 +925,9 @@ const onDragLeave = () => $dragContainer.classList.remove('dragging')
|
||||
|
||||
function startUploadProcess() {
|
||||
console.log("Starting Upload Process..");
|
||||
$('#preparingUploadModal').modal({dismissible: true});
|
||||
$('#preparingUploadModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#preparingUploadModal').modal('open');
|
||||
var streamFinishCount = 0;
|
||||
for (var i = 0; i < MainFileArray.length; i++) {
|
||||
@@ -1040,15 +1081,23 @@ function startUploadProcess() {
|
||||
if (!error) {
|
||||
if (result) {
|
||||
console.log("Result: " + result);
|
||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
||||
$('#minedBlockTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#minedBlockTrackerModal').modal('open');
|
||||
$('#preparingUploadModal').modal({dismissible: true});
|
||||
$('#preparingUploadModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#preparingUploadModal').modal('close');
|
||||
waitForReceipt(result, function (receipt) {
|
||||
console.log("Transaction Has Been Mined: " + receipt);
|
||||
$('#minedBlockTrackerModal').modal({dismissible: true});
|
||||
$('#minedBlockTrackerModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#minedBlockTrackerModal').modal('close');
|
||||
$('#nodeModal').modal({dismissible: true});
|
||||
$('#nodeModal').modal({
|
||||
dismissible: true
|
||||
});
|
||||
$('#nodeModal').modal('close');
|
||||
var filesForStream = MainFileArray;
|
||||
streamFilesExternally(filesForStream, MainHashArray);
|
||||
|
||||
@@ -27,14 +27,15 @@
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="block-header">
|
||||
<h2>DASHBOARD -
|
||||
<span id="accountaddress" style="word-break: break-word;"></span> -
|
||||
<span id="welcome-name"></span>
|
||||
<h2>
|
||||
<span id="accountaddress" style="word-break: break-word;"></span>
|
||||
<span id="welcome-name">
|
||||
</span>
|
||||
<span id="ethobalance"></span>
|
||||
</h2>
|
||||
</div>
|
||||
<!-- 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="info-box bg-pink hover-expand-effect">
|
||||
<div class="icon">
|
||||
@@ -127,9 +128,13 @@
|
||||
|
||||
</div>
|
||||
<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>
|
||||
<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>
|
||||
</center>
|
||||
<h1></h1>
|
||||
@@ -386,7 +391,7 @@
|
||||
|
||||
<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" 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>
|
||||
</main>
|
||||
</div>
|
||||
@@ -692,11 +697,14 @@
|
||||
<script src="assets/dashboard/plugins/jquery-countto/jquery.countTo.js"></script>
|
||||
<!-- Custom Js -->
|
||||
<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/bundle.js"></script>
|
||||
<!-- Demo Js -->
|
||||
<script src="assets/dashboard/js/demo.js"></script>
|
||||
<script src="assets/dashboard/js/medium.js"></script>
|
||||
<script type="text/javascript">
|
||||
checkLogin();
|
||||
</script>
|
||||
<script>
|
||||
MediumWidget.Init({
|
||||
renderTo: '#medium-widget',
|
||||
|
||||
Reference in New Issue
Block a user