Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

- Added a button on the client with its handlers on rsk-helper.js to …

…refresh captcha-image.

- Added font-files for bootstrap controls.
- Added some git-ignores.
- Resized some controls on the page around the captcha.
  • Loading branch information
martin75carames committed May 30, 2017
1 parent 049c925 commit 3b61418200da150e8eed051a5bf86eb10880bd96
@@ -1,3 +1,5 @@
node_modules
.node*
config.json
sessions
.idea
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@


var urlOfFaucetServer = "https://faucet.rsk.co";

$(document).ready(function(){
$.ajax({
type: "GET",
@@ -13,7 +14,14 @@ $(document).ready(function(){
error: function (xhr, status, error) {
console.log("Faucet balance retrieval error.")
}
});
});


$( "#btnRefresh" ).click(function() {
console.log("button captcha refresh")
$( "#captchaImgDiv" ).load(window.location.href + " #captchaImgDiv");
})


$( "#toRskBtn" ).click(function() {
try {
@@ -41,11 +49,9 @@ $(document).ready(function(){
}
$("#toRskResult").html('<h3 class="has-error">' + errorMsg + '</h3>');
}
});
});
} catch(err) {
$("#toRskResult").html('<h3 class="has-error">' + err.message + '</h3>');
}
});
});


@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -44,14 +43,27 @@ <h1> RSK Testnet Faucet</h1>
<div id="faucetBalance"></div>
<div id="toRskForm">
<h3> Enter your RSK address: </h3>
<input id="rskAddress" size="60" placeholder="Eg. 0xbd2a3d9f938e13cd947ec05cde7fe734df8dd831">
<input id="rskAddress" style="height: 35px;" size="55" placeholder="Eg. 0xbd2a3d9f938e13cd947ec05cde7fe734df8dd831">
<br/><br/>
<center>
<img src="/captcha.jpg">
<input type="text" id="captchaInputText">
<div id="captchaImgDiv" style="height: 105px;">
<img src="/captcha.jpg" id="captchaImg">
</div>
<div style="height: 35px;
width: 168px;">
<div style="float: left">
<input type="text" id="captchaInputText" style=" height: 35px;
width: 122px;">
</div>
<div style="float: right;">
<a id="btnRefresh" href="#" class="btn btn-default btn-md">
<span class="glyphicon glyphicon-refresh"></span>
</a>
</div>
</div>
</center>
<br/>
<button id="toRskBtn" type='button'>Get RSKs!</button>
<button id="toRskBtn" type="button" class="btn btn-success btn-lg">Get Smart-BTCs!</button>
</div>
<div id="toRskResult"></div>
</div>
@@ -26,6 +26,7 @@ app.use(session({
app.use('/css', express.static('css'));
app.use('/img', express.static('img'));
app.use('/lib', express.static('lib'));
app.use('/fonts', express.static('fonts'));
app.use(express.static('public'));
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
@@ -41,9 +42,10 @@ const captchaId = 'captcha'
const captchaFieldName = 'captcha'

app.use(cookieParser())
const captcha = require('captcha').create({ cookie: captchaId })
app.get(captchaUrl, captcha.image())

const captcha = require('captcha').create({ cookie: captchaId, codeLength: 6,
color: 'rgb(0,100,100)', background: 'rgb(255,200,150)',
lineWidth: 2, fontSize: 55,
canvasWidth: 170, canvasHeight: 100 })
var port;
var rskNode;
var faucetAddress;
@@ -90,7 +92,6 @@ getWeb3();
extendWeb3();

function executeTransfer(destinationAddress) {

loadPk();
var result = web3.eth.sendTransaction({from: faucetAddress, to: destinationAddress.toLowerCase(), gasPrice: gasPrice, gas: gas, value: valueToSend});
console.log('transaction hash', result);
@@ -144,6 +145,8 @@ function accountAlreadyUsed(account) {
return acc in faucetHistory;
}

app.get(captchaUrl, captcha.image());

app.get('/balance', function (req, res) {
var balance = web3.eth.getBalance(faucetAddress);

0 comments on commit 3b61418

Please sign in to comment.
You can’t perform that action at this time.