X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Ftemplate%2Fotp-html.js;h=5777d3981219ad1ba851e7001f98b8b3b3bfe4ae;hb=9c8e775e5ab96a1788f535760bfa72205c430d15;hp=389f68670964b4a4b6fbb9daa45246fa4168d42a;hpb=2c3ddf0a6f40b9d0a4e54fa12b84b8af33eaaadc;p=squeep-authentication-module diff --git a/lib/template/otp-html.js b/lib/template/otp-html.js index 389f686..5777d39 100644 --- a/lib/template/otp-html.js +++ b/lib/template/otp-html.js @@ -3,10 +3,31 @@ const { TemplateHelper: th } = require('@squeep/html-template-helper'); const { sessionNavLinks } = require('./helpers'); +/** + * @typedef {object} Context + * @property {string[]=} otpBlurb content accompanying otp entry + * @property {string} otpState packed otp state + */ + +/** + * @alias {object} HtmlOptions + */ + +/** + * @typedef {import('../session-manager').AppTemplateCallback} AppTemplateCallback + */ + + /** * Login form, continued. */ +/** + * + * @param {Context} ctx context + * @param {HtmlOptions} options htmlOptions + * @returns {string} section + */ function otpSection(ctx, options) { const otpBlurb = (options.otpBlurb || []).map((x) => '\t'.repeat(6) + x).join('\n'); return `\t\t\t
@@ -27,19 +48,17 @@ ${otpBlurb} /** * Render 2fs form. - * @param {Object} ctx - * @param {String[]=} ctx.errors - * @param {String} ctx.otpState - * @param {Object} options - * @param {String[]=} options.authenticator.otpBlurb - * @param {String[]=} options.authenticator.loginBlurb - * @param {Object} options.manager - * @param {String} options.manager.pageTitle - * @param {String=} options.manager.logoUrl - * @param {Object} options.dingus - * @param {String} options.dingus.selfBaseUrl - * @param {() => {}} appCb - * @returns {String} + * @param {Context} ctx context + * @param {object} options options + * @param {string[]=} options.authenticator.otpBlurb content accompanying otp entry + * @param {object} options.manager manager options + * @param {string} options.manager.pageTitle page title + * @param {string=} options.manager.logoUrl logo url + * @param {string=} options.manager.logoAlt logo alt text + * @param {object} options.dingus dingus options + * @param {string} options.dingus.selfBaseUrl root url + * @param {AppTemplateCallback} appCb function to mogrify htmlOptions + * @returns {string} page */ module.exports = (ctx, options, appCb = () => {}) => { const pagePathLevel = 1;