3 const { TemplateHelper: th
} = require('@squeep/html-template-helper');
6 * Login form, continued.
9 function otpSection(ctx
, options
) {
10 const otpBlurb
= (options
.otpBlurb
|| []).map((x
) => '\t'.repeat(6) + x
).join('\n');
11 return `\t\t\t<section class="otp">
12 \t\t\t\t<form method="POST">
14 \t\t\t\t\t\t<legend>Two-Factor Authentication</legend>
15 \t\t\t\t\t\t<label for="otp">OTP Code</label>
16 \t\t\t\t\t\t<input type="tel" id="otp" name="otp" value="">
18 \t\t\t\t\t\t<button type="submit">Confirm</button>
21 \t\t\t\t\t<input type="hidden" name="state" value="${ctx.otpState}">
30 * @param {String[]=} ctx.errors
31 * @param {String} ctx.otpState
32 * @param {Object} options
33 * @param {String[]=} options.authenticator.otpBlurb
34 * @param {String[]=} options.authenticator.loginBlurb
35 * @param {Object} options.manager
36 * @param {String} options.manager.pageTitle
37 * @param {String=} options.manager.logoUrl
38 * @param {Object} options.dingus
39 * @param {String} options.dingus.selfBaseUrl
42 module
.exports
= (ctx
, options
) => {
44 pageTitle: options
.manager
.pageTitle
,
45 logoUrl: options
.manager
.logoUrl
,
46 footerEntries: options
.manager
.footerEntries
,
47 otpBlurb: options
.authenticator
?.otpBlurb
,
50 ...(options
.authenticator
?.loginBlurb
|| []),
51 otpSection(ctx
, htmlOptions
),
53 return th
.htmlPage(2, ctx
, htmlOptions
, mainContent
);