support interaction between module and apps for updating templates before rendering
[squeep-authentication-module] / lib / template / settings-html.js
index c5bb6c082909bd92274ca3242a76c33b3764e574..42bfdcda4fedae3e6c12a25177cb87943f41bfbc 100644 (file)
@@ -3,6 +3,7 @@
 /* eslint-disable no-unused-vars */
 
 const { TemplateHelper: th } = require('@squeep/html-template-helper');
+const { sessionNavLinks } = require('./helpers');
 const { TOTP } = require('@squeep/totp');
 
 function updatePasswordSection(ctx, htmlOptions) {
@@ -93,16 +94,20 @@ function OTPSection(ctx, htmlOptions) {
 }
 
 
-module.exports = (ctx, options) => {
+module.exports = (ctx, options, appCb = () => {}) => {
+  const pagePathLevel = 1;
   const htmlOptions = {
+    pageIdentifier: 'account',
     pageTitle: options.manager.pageTitle,
     logoUrl: options.manager.logoUrl,
     footerEntries: options.manager.footerEntries,
   };
+  appCb(pagePathLevel, ctx, htmlOptions);
+  sessionNavLinks(pagePathLevel, ctx, htmlOptions);
   const mainContent = [
     OTPSection(ctx, htmlOptions),
     updatePasswordSection(ctx, htmlOptions),
   ];
 
-  return th.htmlPage(1, ctx, htmlOptions, mainContent);
+  return th.htmlPage(pagePathLevel, ctx, htmlOptions, mainContent);
 };