Merge pull request #830 from SISheogorath/feature/GDPR

GDPR compliant part 1
This commit is contained in:
Christoph (Sheogorath) Kern 2018-06-17 23:33:57 +02:00 committed by GitHub
commit 56d78a7d6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 216 additions and 30 deletions

View file

@ -2,6 +2,7 @@
// response
// external modules
var fs = require('fs')
var path = require('path')
var markdownpdf = require('markdown-pdf')
var shortId = require('shortid')
var querystring = require('querystring')
@ -61,7 +62,10 @@ function responseError (res, code, detail, msg) {
}
function showIndex (req, res, next) {
res.render(config.indexPath, {
var authStatus = req.isAuthenticated()
var deleteToken = ''
var data = {
url: config.serverURL,
useCDN: config.useCDN,
allowAnonymous: config.allowAnonymous,
@ -81,10 +85,28 @@ function showIndex (req, res, next) {
email: config.isEmailEnable,
allowEmailRegister: config.allowEmailRegister,
allowPDFExport: config.allowPDFExport,
signin: req.isAuthenticated(),
signin: authStatus,
infoMessage: req.flash('info'),
errorMessage: req.flash('error')
})
errorMessage: req.flash('error'),
privacyStatement: fs.existsSync(path.join(config.docsPath, 'privacy.md')),
termsOfUse: fs.existsSync(path.join(config.docsPath, 'terms-of-use.md')),
deleteToken: deleteToken
}
if (authStatus) {
models.User.findOne({
where: {
id: req.user.id
}
}).then(function (user) {
if (user) {
data.deleteToken = user.deleteToken
res.render(config.indexPath, data)
}
})
} else {
res.render(config.indexPath, data)
}
}
function responseHackMD (res, note) {