Updated various parts of the application to improve usability. Started laying some of the ground work for a bulletin board. Added informative emails that keep voters, trustees and organisers updated with the state of an event.

This commit is contained in:
vince0656 2018-09-03 15:39:42 +01:00
parent 59d3b26e95
commit 25a7f72160
7 changed files with 138 additions and 57 deletions

View file

@ -76,39 +76,7 @@
//new function
demosEncrypt.decryptSubmitCiphers = function() {
var skString = $('#secret-key').val();
if (!skString) {
alert("Please enter your secret key");
}
else {
//rebuild our secret key
var ctx = new CTX("BN254CX");
var skBytes = skString.split(",");
var sk = new ctx.BIG.fromBytes(skBytes);
var inputs = $("form input[type=text]");
inputs.each(function() { //for each ciphertext to decrypt
var ciphertext = {
C1: null,
C2: null
};
var temp = JSON.parse($(this).val());
var c1Bytes = getBytes(temp.C1.split(','));
ciphertext.C1 = new ctx.ECP.fromBytes(c1Bytes);
var c2Bytes = getBytes(temp.C2.split(','));
ciphertext.C2 = new ctx.ECP.fromBytes(c2Bytes);
// Perform partial decryption where the method returns an object containing an ECP()
var partial = partDec(sk, ciphertext);
var bytes = [];
partial.D.toBytes(bytes);
$(this).val(bytes.toString());//submit in byte array form
});
}
};
//new function

View file

@ -16,7 +16,7 @@
<h2>Trustee Event Decryption for Event '{{ event.title }}'</h2>
<hr/>
<div class="panel panel-default">
<div class="panel-heading"><strong>Submit your Secret Key as '{{ user_email }}'</strong></div>
<div class="panel-heading"><strong>Upload your Secret Key as '{{ user_email }}'</strong></div>
<div class="panel panel-body">
<input id="secret-key" name="secret-key" class="textinput textInput form-control" type="text" disabled/>
<div class="alert alert-info" role="alert" style="margin-top: 0.75em;">
@ -30,7 +30,7 @@
<input type="file" id="files_sk_upload" name="file" class="btn-info">
</div>
<br/>
<div class="panel-heading"><strong>Ciphers</strong></div>
<div class="panel-heading"><strong>Encrypted Event Data</strong></div>
<div class="panel panel-body">
<form id="cipher-form" method="POST">
{% csrf_token %}
@ -48,25 +48,26 @@
<br/>
{% endfor %}
<button id="decrypt-btn"
onclick="demosEncrypt.decryptSubmitCiphers()"
onclick="decryptSubmitCiphers()"
class="btn btn-success">
Decrypt & Submit</button>
Send Partial Decryptions</button>
</form>
</div>
</div>
</div>
<!-- Information Dialog called upon request -->
<div class="modal fade" id="modalDialog" role="dialog">
<div class="modal-dialog">
<div class="modal fade" id="modalDialog" role="dialog" tabindex="-1" data-backdrop="static">
<div class="modal-dialog" role="document">
<!-- Dialog content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title" style="text-align: center"><strong>Thank You</strong></h4>
<h4 class="modal-title" style="text-align: center"><strong>Partial Decryption Successfully Received</strong></h4>
</div>
<div class="modal-body">
<p>Thank you! You can now close down this page.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

View file

@ -12,7 +12,7 @@
<h4>Key Generation For: {{ user_email }}</h4>
<br/>
<div class="panel panel-default">
<div class="panel-heading"><strong>Step 1: Generate Your Secret Key</strong></div>
<div class="panel-heading"><strong>Step 1: Generate and Download Your Secret Key</strong></div>
<div class="panel panel-body">
<input id="secret-key" class="textinput textInput form-control" type="text"/>
<input id="event-param" type="text" value="{{event.EID}}" hidden/>