remove front form for restricted access

This commit is contained in:
Mark Kaylor 2021-10-06 15:25:05 -04:00
parent 72a128af83
commit 62299883f1
3 changed files with 4 additions and 39 deletions

View File

@ -19,13 +19,13 @@ module.exports = {
try {
const docService = strapi.plugin('documentation').service('documentation');
const docVersions = docService.getDocumentationVersions();
const form = await docService.getFrontendForm();
const documentationAccess = await docService.getDocumentationAccess();
ctx.send({
docVersions,
currentVersion: docService.getDocumentationVersion(),
prefix: strapi.plugin('documentation').config('x-strapi-config').path,
form,
documentationAccess,
});
} catch (err) {
ctx.badRequest(null, err.message);

View File

@ -6,7 +6,6 @@ const moment = require('moment');
const { builApiEndpointPath } = require('../utils/builders');
const defaultConfig = require('../config/default-config');
const form = require('./utils/forms');
module.exports = () => {
const docPlugin = strapi.plugin('documentation');
@ -57,7 +56,7 @@ module.exports = () => {
.filter(x => x);
},
async getFrontendForm() {
async getDocumentationAccess() {
const config = await strapi
.store({
environment: '',
@ -67,12 +66,7 @@ module.exports = () => {
})
.get();
const forms = JSON.parse(JSON.stringify(form));
_.set(forms, [0, 0, 'value'], config.restrictedAccess);
_.set(forms, [0, 1, 'value'], config.password || '');
return forms;
return { restrictedAccess: config.restrictedAccess, password: config.password || '' };
},
/**

View File

@ -1,29 +0,0 @@
[
[
{
"name": "restrictedAccess",
"label": {
"id": "documentation.containers.HomePage.form.restrictedAccess"
},
"type": "toggle",
"inputDescription": {
"id": "documentation.containers.HomePage.form.restrictedAccess.inputDescription"
},
"inputDescriptionStyle": { "marginBottom": "2px"},
"value": false
},
{
"name": "password",
"label": {
"id": "documentation.containers.HomePage.form.password"
},
"customBootstrapClass": "col-md-4",
"type": "password",
"inputDescription": {
"id": "documentation.containers.HomePage.form.password.inputDescription"
},
"validations": { "required": true },
"value": ""
}
]
]