Updated README to include details on dependency requirements. Updated Create Event page to disable the create button when the reCAPTCHA expires

This commit is contained in:
vince0656 2018-06-12 14:30:23 +01:00
parent c2010f5a4f
commit 49ed8a3ec9
3 changed files with 43 additions and 3 deletions

View file

@ -4,4 +4,37 @@ Prototype Django based e-voting application, to demonstrate DEMOS2's client-side
The previous repository for DEMOS2 by Carey Williams can be found at: https://github.com/CareyJWilliams/DEMOS2 The previous repository for DEMOS2 by Carey Williams can be found at: https://github.com/CareyJWilliams/DEMOS2
[//]: # (Not sure about this that was included in the readme: The Node.js encryption server depends on the milagro-crypto-js library. Download the source and follow the instructions for installation: https://github.com/milagro-crypto/milagro-crypto-js. To install, place the package's files (`package.json` level) into the directory Node/milagro-crypto-js (a new folder) then run `npm install` in the Node folder. This should install dependencies including the local package you just added.) ### Dependencies
Python: Version 2.7 (Anything higher than this will not currently work)
Python packages: Specified in 'requirements.txt' - PyCharm will detect these dependencies and offer installation
MySQL Server: Community Ed will do - initialised with legacy password authentication
New MySQL DB User: Default username and password specified in 'aullauthdemo/settings.py'
New MySQL DB: demos2 (also specified in 'aullauthdemo/settings.py') - make sure to set the charset to UTF8
Finally, with all the above dependencies in place, you can simply issue the following command to initialise the DB:
python manage.py migrate
'aullauthdemo/settings.py' specifies the Google reCAPTCHA site key and private key which will need changing when deployed
onto a new domain.
### Running the server and creating a new user account
You can run the server with the following command:
python manage.py runserver
The application will then be available at:
127.0.0.1:8000
You can then click on 'Join' to create a new user account. Currently, a server error is thrown when you create a new
email account saying something like 'Too Many Attempts'. Rest assured that the account will have been created. Navigate
back to the home page and you should be able to log in. This will hopefully be fixed in a future version.
### Other
This was included in the previous readme and may be required:
The Node.js encryption server depends on the milagro-crypto-js library. Download the source and follow the instructions for installation: https://github.com/milagro-crypto/milagro-crypto-js. To install, place the package's files (`package.json` level) into the directory Node/milagro-crypto-js (a new folder) then run `npm install` in the Node folder. This should install dependencies including the local package you just added.

View file

@ -409,7 +409,10 @@
<div class="form-group"> <div class="form-group">
<label for="recaptcha-input" class="col-sm-3 col-md-2 control-label">reCAPTCHA:</label> <!-- This text can be a template variable --> <label for="recaptcha-input" class="col-sm-3 col-md-2 control-label">reCAPTCHA:</label> <!-- This text can be a template variable -->
<div class="col-sm-9 col-md-10"> <div class="col-sm-9 col-md-10">
<div class="g-recaptcha" data-callback="recaptchaCallback" data-sitekey="{{ G_R_SITE_KEY }}"></div> <!-- Need to finish server implementation and import key from settings --> <div class="g-recaptcha"
data-callback="reCVerificationCallback"
data-expired-callback="reCExpiredCallback"
data-sitekey="{{ G_R_SITE_KEY }}"></div> <!-- Need to finish server implementation and import key from settings -->
<span id="recaptcha-input-help-block" class="help-block"> <span id="recaptcha-input-help-block" class="help-block">
<!-- Error handling / input validation has been removed temporarily and would be placed here --> <!-- Error handling / input validation has been removed temporarily and would be placed here -->
Tick the box to prove that you're not a robot. Tick the box to prove that you're not a robot.

View file

@ -54,10 +54,14 @@ document.getElementById('files').addEventListener('change', processFileChange, f
// reCAPTCHA // reCAPTCHA
function recaptchaCallback(){ function reCVerificationCallback() {
$('#submit-event-create').removeAttr('disabled'); $('#submit-event-create').removeAttr('disabled');
} }
function reCExpiredCallback() {
$('#submit-event-create').prop('disabled', true);
}
// Slug field. // Slug field.
function slugify(value) { function slugify(value) {