diff --git a/messages/login/messages.go b/messages/login/messages.go index 30891e7dd..cb4b76c43 100644 --- a/messages/login/messages.go +++ b/messages/login/messages.go @@ -17,6 +17,5 @@ const ( AskPassword = "Enter your password:" //browser - VisitMsg = "Please visit https://sso.azion.com/login?next=cli in case it did not open automatically\n" - BrowserMsg = "You may now close this page and return to your terminal" + VisitMsg = "Please visit https://sso.azion.com/login?next=cli in case it did not open automatically\n" ) diff --git a/pkg/cmd/login/browser.go b/pkg/cmd/login/browser.go index deb9abb5c..ba9296a51 100644 --- a/pkg/cmd/login/browser.go +++ b/pkg/cmd/login/browser.go @@ -2,7 +2,6 @@ package login import ( "context" - "io" "net/http" msg "github.com/aziontech/azion-cli/messages/login" @@ -44,7 +43,69 @@ func (l *login) browserLogin(srv Server) error { if enableHandlerRouter { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { paramValue := r.URL.Query().Get("c") - _, _ = io.WriteString(w, msg.BrowserMsg) + + htmlResponse := ` + + + + + + + Azion + + + +
+ +
Authenticated, you can now close this page and return to your terminal
+
+ + + ` + + w.Header().Set("Content-Type", "text/html") + w.WriteHeader(http.StatusOK) + _, err := w.Write([]byte(htmlResponse)) + if err != nil { + logger.Error("Error render html", zap.Error(err)) + } + if paramValue != "" { tokenValue = paramValue }