36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
// The plugin "gear" on Settings -> Plugins always opens /plugins/configure/<name>,
|
|
// which renders THIS workflow's form (the core configure route has no redirect
|
|
// hook). saltcorn-idp's real settings live in its own admin dashboard, so this
|
|
// single step bounces straight there with NO extra click.
|
|
//
|
|
// NOTE: blurb MUST be an ARRAY -- the array path is rendered raw (form.ts join),
|
|
// whereas a string blurb is run through the text() XSS whitelist, which strips
|
|
// <script>/<meta>. CSP allows 'unsafe-inline', so the inline script redirect is
|
|
// the primary path; the <noscript> meta-refresh and the visible button are
|
|
// fallbacks (the link is what shows if script/meta are ever stripped).
|
|
|
|
const Workflow = require("@saltcorn/data/models/workflow");
|
|
const Form = require("@saltcorn/data/models/form");
|
|
const { ADMIN_BASE_PATH } = require("./constants");
|
|
|
|
|
|
const configurationWorkflow = () =>
|
|
new Workflow({
|
|
steps: [
|
|
{
|
|
name: "saltcorn-idp",
|
|
form: async () =>
|
|
new Form({
|
|
blurb: [
|
|
`<script>window.location.replace(${JSON.stringify(ADMIN_BASE_PATH)});</script>`,
|
|
`<noscript><meta http-equiv="refresh" content="0; url=${ADMIN_BASE_PATH}"></noscript>`,
|
|
`<p>Opening the saltcorn-idp dashboard… <a class="btn btn-primary" role="button" href="${ADMIN_BASE_PATH}">Open the saltcorn-idp dashboard</a></p>`,
|
|
],
|
|
fields: []
|
|
})
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
module.exports = { configurationWorkflow };
|