api: Show privacy policy checkbox in registration, if a URL is provided
This commit is contained in:
parent
1dce9aba60
commit
3bb87989b2
|
@ -25,5 +25,7 @@
|
|||
"refreshTokenExpirySeconds": 86400000,
|
||||
"title": "OpenBikeSensor"
|
||||
}
|
||||
]
|
||||
],
|
||||
"imprintUrl": "https://example.com/imprint",
|
||||
"privacyPolicyUrl": "https://example.com/privacy"
|
||||
}
|
||||
|
|
|
@ -32,5 +32,7 @@
|
|||
"refreshTokenExpirySeconds": 86400000,
|
||||
"title": "OpenBikeSensor"
|
||||
}
|
||||
]
|
||||
],
|
||||
"imprintUrl": "https://example.com/imprint",
|
||||
"privacyPolicyUrl": "https://example.com/privacy"
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ const configSchema = Joi.object({
|
|||
jwtSecret: Joi.string().min(16).max(128).required(),
|
||||
cookieSecret: Joi.string().min(16).max(128).required(),
|
||||
|
||||
imprintUrl: Joi.string(),
|
||||
privacyPolicyUrl: Joi.string(),
|
||||
|
||||
baseUrl: Joi.string().required(),
|
||||
mainFrontendUrl: Joi.string(), // optional
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ function isValidScope(scope) {
|
|||
router.use((req, res, next) => {
|
||||
res.locals.user = req.user;
|
||||
res.locals.mainFrontendUrl = config.mainFrontendUrl;
|
||||
res.locals.imprintUrl = config.imprintUrl;
|
||||
res.locals.privacyPolicyUrl = config.privacyPolicyUrl;
|
||||
res.locals.baseUrl = baseUrl + '/';
|
||||
next();
|
||||
});
|
||||
|
@ -463,6 +465,10 @@ router
|
|||
email: Joi.string().email().required(),
|
||||
password: Joi.string().min(6).required(),
|
||||
confirmPassword: Joi.string().valid(Joi.ref('password')).required(),
|
||||
|
||||
...(config.privacyPolicyUrl ? {
|
||||
acceptPrivacyPolicy: Joi.boolean().truthy().required(),
|
||||
} : {}),
|
||||
}),
|
||||
),
|
||||
wrapRoute(async (req, res) => {
|
||||
|
|
|
@ -22,4 +22,17 @@ block content
|
|||
label(for="confirmPassword") Confirm Password
|
||||
input(id="confirmPassword", name="confirmPassword", type="password")
|
||||
|
||||
if privacyPolicyUrl
|
||||
.field
|
||||
label Privacy policy
|
||||
|
||||
.ui.checkbox
|
||||
input(id="acceptPrivacyPolicy", name="acceptPrivacyPolicy", type="checkbox", value="true")
|
||||
label(for="acceptPrivacyPolicy")
|
||||
| I have read and understood the
|
||||
|
|
||||
a(href=privacyPolicyUrl, target="_blank", rel="noreferrer") privacy policy
|
||||
|
|
||||
| and consent to the use of my data as described therein.
|
||||
|
||||
button.ui.button.primary(type="submit") Register
|
||||
|
|
Loading…
Reference in a new issue