From 59b2e1078708e212f160c9164a8c623609cdaf39 Mon Sep 17 00:00:00 2001 From: f0x52 Date: Sat, 18 Feb 2023 16:47:42 +0100 Subject: [PATCH] [bugfix] fix oob token route, update templates+css for oob and errors (#1519) --- internal/oauth/server.go | 2 +- web/source/css/base.css | 19 ++++++++++--------- web/template/error.tmpl | 17 +++++++++++------ web/template/oob.tmpl | 13 +++++++------ 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/internal/oauth/server.go b/internal/oauth/server.go index c4e2f6bf3..082a2c8fa 100644 --- a/internal/oauth/server.go +++ b/internal/oauth/server.go @@ -53,7 +53,7 @@ const ( // OOBURI is the out-of-band oauth token uri OOBURI = "urn:ietf:wg:oauth:2.0:oob" // OOBTokenPath is the path to redirect out-of-band token requests to. - OOBTokenPath = "/oob" + OOBTokenPath = "/oauth/oob" // #nosec G101 else we get a hardcoded credentials warning // HelpfulAdvice is a handy hint to users; // particularly important during the login flow HelpfulAdvice = "If you arrived at this error during a login/oauth flow, please try clearing your session cookies and logging in again; if problems persist, make sure you're using the correct credentials" diff --git a/web/source/css/base.css b/web/source/css/base.css index ca15984e3..d9b3e170e 100644 --- a/web/source/css/base.css +++ b/web/source/css/base.css @@ -277,19 +277,11 @@ section.login { section.error { word-break: break-word; - display: flex; - flex-direction: row; - align-items: center; margin-bottom: 0.5rem; - span { - font-size: 2em; - } - pre { border: 1px solid #ff000080; - margin-left: 1em; - padding: 0 0.7em; + padding: 0.5rem; border-radius: 0.5em; background-color: #ff000010; font-size: 1.3em; @@ -297,6 +289,15 @@ section.error { } } +section.oob-token { + code { + background: $gray1; + padding: 0.5rem; + margin: 0; + border-radius: 0.3rem; + } +} + .error-text { color: $error1; background: $error2; diff --git a/web/template/error.tmpl b/web/template/error.tmpl index 9cc21b296..ab295d00f 100644 --- a/web/template/error.tmpl +++ b/web/template/error.tmpl @@ -17,10 +17,15 @@ */ -}} {{ template "header.tmpl" .}} -
-
-
{{.error}}
- Request ID {{.requestID}} -
-
+
+
+

An error occured:

+
{{.error}}
+ {{if .requestID}} +
+ Request ID: {{.requestID}} +
+ {{end}} +
+
{{ template "footer.tmpl" .}} \ No newline at end of file diff --git a/web/template/oob.tmpl b/web/template/oob.tmpl index 0328df9bd..f96956f7a 100644 --- a/web/template/oob.tmpl +++ b/web/template/oob.tmpl @@ -17,10 +17,11 @@ */ -}} {{ template "header.tmpl" .}} -
-

Hi {{ .user }}!

-

Here's your out-of-band token with scope {{.scope}}:

-

{{ .oobToken }}

-

Use it wisely!

-
+
+
+

Hi {{ .user }}!

+

Here's your out-of-band token with scope "{{.scope}}", use it wisely:

+ {{ .oobToken }} +
+
{{ template "footer.tmpl" .}} \ No newline at end of file