diff --git a/webui/confirm.tmpl b/webui/confirm.tmpl index 2c8972e..049208e 100644 --- a/webui/confirm.tmpl +++ b/webui/confirm.tmpl @@ -11,12 +11,6 @@ diff --git a/webui/login.tmpl b/webui/login.tmpl index 728c4b4..af2c7a8 100644 --- a/webui/login.tmpl +++ b/webui/login.tmpl @@ -8,13 +8,21 @@ + + -
+ - +
diff --git a/webui/styles.css b/webui/styles.css index d2bc126..c76c26b 100644 --- a/webui/styles.css +++ b/webui/styles.css @@ -79,6 +79,13 @@ main { justify-content: center; } +.dialog { + margin: 20px; + padding: 20px; + font-size: 18px; + border: 1px solid black; +} + .tunnel-list { display: flex; flex-direction: column; diff --git a/webui_handler.go b/webui_handler.go index 23e879d..b131ecc 100644 --- a/webui_handler.go +++ b/webui_handler.go @@ -29,6 +29,10 @@ type ConfirmData struct { CancelUrl string } +type LoginData struct { + Styles template.CSS +} + func NewWebUiHandler(config *BoringProxyConfig, db *Database, auth *Auth, tunMan *TunnelManager) *WebUiHandler { return &WebUiHandler{ config, @@ -62,7 +66,7 @@ func (h *WebUiHandler) handleWebUiRequest(w http.ResponseWriter, r *http.Request token, err := extractToken("access_token", r) if err != nil { - loginTemplate, err := box.String("login.tmpl") + loginTemplateStr, err := box.String("login.tmpl") if err != nil { log.Println(err) w.WriteHeader(500) @@ -70,8 +74,21 @@ func (h *WebUiHandler) handleWebUiRequest(w http.ResponseWriter, r *http.Request return } + loginTemplate, err := template.New("test").Parse(loginTemplateStr) + if err != nil { + w.WriteHeader(500) + log.Println(err) + io.WriteString(w, "Error compiling login.tmpl") + return + } + + loginData := LoginData{ + Styles: template.CSS(stylesText), + } + + w.WriteHeader(401) - io.WriteString(w, loginTemplate) + loginTemplate.Execute(w, loginData) return }