X-Git-Url: https://git.squeep.com/?p=squeep-authentication-module;a=blobdiff_plain;f=lib%2Ftemplate%2Fotp-html.js;fp=lib%2Ftemplate%2Fotp-html.js;h=cf7cef686ba7582fe659e36831b69a3e3b70a4ae;hp=0000000000000000000000000000000000000000;hb=2ca511865b0caf3108819cfd6ee775124ea70dff;hpb=8b998e55749e8613c0dece7a156b5edf83fb3608 diff --git a/lib/template/otp-html.js b/lib/template/otp-html.js new file mode 100644 index 0000000..cf7cef6 --- /dev/null +++ b/lib/template/otp-html.js @@ -0,0 +1,54 @@ +'use strict'; + +const { TemplateHelper: th } = require('@squeep/html-template-helper'); + +/** + * Login form, continued. + */ + +function otpSection(ctx, options) { + const otpBlurb = (options.otpBlurb || []).map((x) => '\t'.repeat(6) + x).join('\n'); + return `\t\t\t
+\t\t\t\t
+\t\t\t\t\t
+\t\t\t\t\t\tTwo-Factor Authentication +\t\t\t\t\t\t +\t\t\t\t\t\t +\t\t\t\t\t\t
+\t\t\t\t\t\t +${otpBlurb} +\t\t\t\t\t
+\t\t\t\t\t +\t\t\t\t
+\t\t\t { + const htmlOptions = { + pageTitle: options.manager.pageTitle, + logoUrl: options.manager.logoUrl, + footerEntries: options.manager.footerEntries, + otpBlurb: options.authenticator?.otpBlurb, + }; + const mainContent = [ + ...(options.authenticator?.loginBlurb || []), + otpSection(ctx, htmlOptions), + ]; + return th.htmlPage(2, ctx, htmlOptions, mainContent); +}; \ No newline at end of file