+
+
+
+
+
+
+
+
+ %s
+%s
+ diff --git a/internal/auth/authutil/browser.go b/internal/auth/authutil/browser.go index 093640f29..10e03b7ca 100644 --- a/internal/auth/authutil/browser.go +++ b/internal/auth/authutil/browser.go @@ -2,6 +2,7 @@ package authutil import ( "context" + _ "embed" "fmt" "net/http" "time" @@ -33,9 +34,13 @@ func WaitForBrowserCallback(addr string) (code string, state string, err error) } if cb.code == "" { - _, _ = w.Write([]byte("
❌ Unable to extract code from request, please try authenticating again.
")) + _, _ = w.Write([]byte(resultPage("Login Failed", + "Unable to extract code from request, please try authenticating again.", + "error-denied"))) } else { - _, _ = w.Write([]byte("👋 You can close the window and go back to the CLI to see the user info and tokens.
")) + _, _ = w.Write([]byte(resultPage("Login Successful", + "You can close the window and go back to the CLI to see the user info and tokens.", + "success-lock"))) } cbCh <- cb @@ -62,3 +67,10 @@ func WaitForBrowserCallback(addr string) (code string, state string, err error) return "", "", err } } + +//go:embed data/result-page.html +var resultHTML string + +func resultPage(title string, message string, iconClass string) string { + return fmt.Sprintf(resultHTML, iconClass, title, message) +} diff --git a/internal/auth/authutil/data/result-page.html b/internal/auth/authutil/data/result-page.html new file mode 100644 index 000000000..2e6f40429 --- /dev/null +++ b/internal/auth/authutil/data/result-page.html @@ -0,0 +1,97 @@ + + + +