From 67f43d95af917a670ee1bc4d27a1358567ee132a Mon Sep 17 00:00:00 2001 From: reya Date: Tue, 23 Jan 2024 13:35:28 +0700 Subject: [PATCH] add base url to template --- src/daemon/web/authorize.ts | 3 ++- templates/createAccount.handlebar | 2 +- templates/login.handlebar | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/daemon/web/authorize.ts b/src/daemon/web/authorize.ts index e54fa2a..589a5ee 100644 --- a/src/daemon/web/authorize.ts +++ b/src/daemon/web/authorize.ts @@ -163,6 +163,7 @@ export async function processRegistrationWebHandler(request, reply) { try { const record = await getAndValidateStateOfRequest(request); const body = request.body; + const baseUrl = new URL(request.url).pathname.split('/')[1]; // we serialize the payload again and store it // along with the allowed flag @@ -179,7 +180,7 @@ export async function processRegistrationWebHandler(request, reply) { const [ username, domain, email ] = JSON.parse(record.params!); const nip05 = `${username}@${domain}`; - return reply.view("/templates/createAccount.handlebar", { record, email, username, domain, nip05, error: e.message}); + return reply.view("/templates/createAccount.handlebar", { baseUrl, record, email, username, domain, nip05, error: e.message}); } await prisma.request.update({ diff --git a/templates/createAccount.handlebar b/templates/createAccount.handlebar index 3cc84c3..fe578e1 100644 --- a/templates/createAccount.handlebar +++ b/templates/createAccount.handlebar @@ -87,7 +87,7 @@
{{#if error}} diff --git a/templates/login.handlebar b/templates/login.handlebar index a30a8c0..446e2d4 100644 --- a/templates/login.handlebar +++ b/templates/login.handlebar @@ -52,7 +52,7 @@