Fixes template issue with new OAuth impl (#1901)

This commit is contained in:
Mihovil Ilakovac 2024-03-18 16:23:27 +01:00 committed by GitHub
parent 72ebdb8d8c
commit ea247dc4fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,8 @@
{{={= =}=}}
import { Router } from "express";
{=# isExternalAuthEnabled =}
import { setupOneTimeCodeRoute } from "./oauth/oneTimeCode";
{=/ isExternalAuthEnabled =}
{=# providers =}
{=& importStatement =}
@ -14,9 +16,11 @@ const providers = [
const router = Router();
{=# isExternalAuthEnabled =}
// Setting up a common route for all OAuth providers to exchange
// one-time code for a session.
setupOneTimeCodeRoute(router);
{=/ isExternalAuthEnabled =}
for (const provider of providers) {
const { createRouter } = provider;

View File

@ -71,7 +71,11 @@ genAuthRoutesIndex auth = return $ C.mkTmplFdWithDstAndData tmplFile dstFile (Ju
genProvidersIndex :: AS.Auth.Auth -> Generator FileDraft
genProvidersIndex auth = return $ C.mkTmplFdWithData [relfile|src/auth/providers/index.ts|] (Just tmplData)
where
tmplData = object ["providers" .= providers]
tmplData =
object
[ "providers" .= providers,
"isExternalAuthEnabled" .= AS.Auth.isExternalAuthEnabled auth
]
providers =
makeConfigImportJson