diff options
| author | Ahmed AbdelHalim <[email protected]> | 2025-09-07 23:07:43 +0200 |
|---|---|---|
| committer | Ahmed AbdelHalim <[email protected]> | 2025-09-07 23:21:21 +0200 |
| commit | b3afec6c0ff240c8ad93c34e713be98d25d535eb (patch) | |
| tree | eb02fca7aaa00222680d9d8cfb02147394d9445b /main.go | |
| parent | 91a4985eacc25178171d2813d88df3fdfa91e188 (diff) | |
Add HTTPS check on the go app with warning on login screen
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 6 |
1 files changed, 4 insertions, 2 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) |
