Terms and conditions screen (#118)

* Terms and Conditions screen added

* missing fields

* SQL migration added

* terms.text: markdown to html on server side

* markdown field type added

* other minor changes
This commit is contained in:
Fabio Cigliano 2018-06-06 07:35:30 +12:00 committed by Josh Harvey
parent d1712ce1ce
commit a30b835786
7 changed files with 1106 additions and 527 deletions

View file

@ -5,6 +5,7 @@ const helmet = require('helmet')
const bodyParser = require('body-parser')
const _ = require('lodash/fp')
const express = require('express')
const nmd = require('nano-markdown')
const options = require('./options')
const logger = require('./logger')
@ -62,6 +63,8 @@ function poll (req, res, next) {
}
}
const terms = config.termsScreenActive ? createTerms(config) : null
const response = {
error: null,
locale,
@ -81,6 +84,7 @@ function poll (req, res, next) {
crossRefVerificationThreshold: config.crossRefVerificationThreshold,
frontCameraVerificationActive: config.frontCameraVerificationActive,
frontCameraVerificationThreshold: config.frontCameraVerificationThreshold,
terms: terms,
cassettes,
twoWayMode: config.cashOutEnabled,
zeroConfLimit: config.zeroConfLimit,
@ -426,4 +430,14 @@ function populateSettings (req, res, next) {
.catch(next)
}
function createTerms(config) {
return {
active: config.termsScreenActive,
title: config.termsScreenTitle,
text: nmd(config.termsScreenText),
accept: config.termsAcceptButtonText,
cancel: config.termsCancelButtonText
}
}
module.exports = {app, localApp}