diff options
| -rw-r--r-- | main.go | 6 | ||||
| -rw-r--r-- | static/css/styles.css | 1 | ||||
| -rw-r--r-- | templates/login.html | 7 |
3 files changed, 10 insertions, 4 deletions
@@ -214,10 +214,12 @@ func (s *Server) handleLogin(w http.ResponseWriter, r *http.Request) { } } -func (s *Server) showLoginForm(w http.ResponseWriter, _ *http.Request) { +func (s *Server) showLoginForm(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") + isHTTPS := r.TLS != nil templateData := map[string]any{ - "Error": "", + "Error": "", + "IsHTTPS": isHTTPS, } if err := s.templates.ExecuteTemplate(w, "login.html", templateData); err != nil { log.Printf("Error rendering login template: %v", err) diff --git a/static/css/styles.css b/static/css/styles.css index 3edbaf2..961241f 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -72,6 +72,7 @@ footer { border-left-width: 14px; padding: 14px; white-space: pre-line; + margin-bottom: 1rem; } .message.loading, diff --git a/templates/login.html b/templates/login.html index bd28803..3fcd987 100644 --- a/templates/login.html +++ b/templates/login.html @@ -16,11 +16,14 @@ <main> <div class="login"> <div class="login__container"> - {{if .Error}} <div id="notifications__container" class="notifications__container"> + {{if not .IsHTTPS}} + <div class="message warning">Consider upgrading to HTTPS for better security.</div> + {{end}} + {{if .Error}} <div class="message error">{{.Error}}</div> + {{end}} </div> - {{end}} <form class="login__form" method="POST" action="/login"> <input type="password" name="password" placeholder="Password" required> |
