From 46466874da46e60e23d6b3f3a72743f9d3e00d0e Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Sun, 28 Feb 2021 22:36:11 +0100 Subject: [PATCH] api: Add baseUrl to templates --- api/src/routes/auth.js | 1 + api/views/authorize.pug | 4 ++-- api/views/layout.pug | 7 ++++--- api/views/login.pug | 2 +- api/views/logout.pug | 2 +- api/views/message.pug | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/api/src/routes/auth.js b/api/src/routes/auth.js index fd6af55..6bbce5f 100644 --- a/api/src/routes/auth.js +++ b/api/src/routes/auth.js @@ -53,6 +53,7 @@ function isValidScope(scope) { router.use((req, res, next) => { res.locals.user = req.user; res.locals.mainFrontendUrl = config.mainFrontendUrl; + res.locals.baseUrl = baseUrl; next(); }); diff --git a/api/views/authorize.pug b/api/views/authorize.pug index 0ef8f73..d94e267 100644 --- a/api/views/authorize.pug +++ b/api/views/authorize.pug @@ -9,9 +9,9 @@ block content minutes time for your decision. .authorization - form(method="post", action="/authorize/decline") + form(method="post", action="authorize/decline") button(type="submit", class="red") Decline - form(method="post", action="/authorize/approve") + form(method="post", action="authorize/approve") button(type="submit", class="green") Approve diff --git a/api/views/layout.pug b/api/views/layout.pug index c67264f..30a65c5 100644 --- a/api/views/layout.pug +++ b/api/views/layout.pug @@ -1,5 +1,6 @@ html head + base(href=baseUrl) title block title | Authorization Server @@ -133,10 +134,10 @@ html if mainFrontendUrl li: a(href=mainFrontendUrl) Back to Portal if !user - li: a(href="/login") Login - li: a(href="/register") Register + li: a(href="login") Login + li: a(href="register") Register if user - li: a(href="/logout") Logout + li: a(href="logout") Logout header: h1 block title block content diff --git a/api/views/login.pug b/api/views/login.pug index 0c646d0..56e040d 100644 --- a/api/views/login.pug +++ b/api/views/login.pug @@ -17,4 +17,4 @@ block content p.message.error Invalid login credentials, please try again. button(type="submit", style="margin-right: 2rem") Login - a(href="/forgot-password") I forgot my password + a(href="forgot-password") I forgot my password diff --git a/api/views/logout.pug b/api/views/logout.pug index 1d899e1..3644c58 100644 --- a/api/views/logout.pug +++ b/api/views/logout.pug @@ -4,5 +4,5 @@ block title | Logout block content - form(method="post", action="/logout") + form(method="post", action="logout") button(type="submit", class="red") Log out now diff --git a/api/views/message.pug b/api/views/message.pug index 637e2dc..de6b1f5 100644 --- a/api/views/message.pug +++ b/api/views/message.pug @@ -8,4 +8,4 @@ block content div(class="message " + type)= description if showLoginButton - p: a(href="/login") Go to login + p: a(href="login") Go to login