Skip to content

Commit

Permalink
Merge pull request sitcomlab#46 from sitcomlab/feature/password_on_cover
Browse files Browse the repository at this point in the history
Added Password Generation on Cover Sheet
  • Loading branch information
SpeckiJ authored Mar 28, 2018
2 parents 99a9e3c + b22126b commit fa5296e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Version 1.4.1
- Added Email Notification to all Members when Review is started (and not pending anymore)
- Added Password Generation on Cover Sheet
- bugfixes & style improvements

# Version 1.4.0
Expand Down
13 changes: 13 additions & 0 deletions controllers/documents/generate_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var moment = require('moment');
var pool = require('../../server.js').pool;
var pdf = require('html-pdf');
var uuid = require("uuid");
var crypto = require('crypto');

var fs = require("fs");
var dir_1 = "/../../templates/pdfs/";
Expand Down Expand Up @@ -163,11 +164,23 @@ exports.request = function(req, res) {
// Create files
async.parallel([
function(callback) { // Generate Cover Sheet

// create distinguishable password
var psw = crypto.randomBytes(32)
.toString('base64')
.replace("1","R")
.replace("I","A")
.replace("0","M")
.replace("O","P")
.replace("U","F")
.replace("V","Z")
.replace("Q","X");
// Render HTML-content
var html = mustache.render(template_cover_sheet, {
document: document,
description: description,
revision: revision,
veracryptpassword: psw,
year: moment().format("YYYY")
});

Expand Down
33 changes: 20 additions & 13 deletions templates/pdfs/cover_sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,43 @@ <h1 style="width:100%; text-align: center;">Cover sheet for research study</h1>
<p style="text-align: justify;">
<b>Document ID:</b>
</p>
<p style="border: 2px solid black; padding: 10px; color: red">
<p style="border: 2px solid black; padding: 10px; color: black">
{{document.document_id}}
</p>
<br>
<p style="text-align: justify;">
<b>Revision:</b>
<b>Name of the Researcher:</b>
</p>
<p style="border: 2px solid black; padding: 10px; color: red">
{{revision.version}}
<p style="border: 2px solid black; padding: 10px; color: black">
{{description.en_researcher}}
</p>
<br>
<p style="text-align: justify;">
<b>Date of last Revision:</b>
<b>Title of study:</b>
</p>
<p style="border: 2px solid black; padding: 10px; color: red">
{{revision.updated}}
<p style="border: 2px solid black; padding: 10px; color: black">
{{document.document_title}}
</p>
<br>
<p style="text-align: justify;">
<b>Name of the Researcher:</b>
<b>Revision Number:</b>
</p>
<p style="border: 2px solid black; padding: 10px; color: red">
{{description.en_researcher}}
<p style="border: 2px solid black; padding: 10px; color: black">
{{revision.version}}
</p>
<br>
<p style="text-align: justify;">
<b>Title of study:</b>
<b>Date of last Revision:</b>
</p>
<p style="border: 2px solid black; padding: 10px; color: red">
{{document.document_title}}
<p style="border: 2px solid black; padding: 10px; color: black">
{{revision.updated}}
</p>
<br>
<p style="text-align: justify;">
<b>Veracrypt Password:</b>
</p>
<p style="border: 2px solid black; padding: 10px; color: black">
{{veracryptpassword}}
</p>
</div>
</body>

0 comments on commit fa5296e

Please sign in to comment.