From efa6f33b4c67f64a4a8d8cd723b9bbc9494fc735 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 5 Apr 2025 21:47:44 +0800 Subject: Unexport fields in Server --- http_handle_login.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'http_handle_login.go') diff --git a/http_handle_login.go b/http_handle_login.go index e02ba10..e626719 100644 --- a/http_handle_login.go +++ b/http_handle_login.go @@ -35,7 +35,7 @@ func (s *Server) httpHandleLogin(writer http.ResponseWriter, request *http.Reque username = request.PostFormValue("username") password = request.PostFormValue("password") - err = s.Database.QueryRow(request.Context(), + err = s.database.QueryRow(request.Context(), "SELECT id, COALESCE(password, '') FROM users WHERE username = $1", username, ).Scan(&userID, &passwordHash) @@ -71,7 +71,7 @@ func (s *Server) httpHandleLogin(writer http.ResponseWriter, request *http.Reque } now = time.Now() - expiry = now.Add(time.Duration(s.Config.HTTP.CookieExpiry) * time.Second) + expiry = now.Add(time.Duration(s.config.HTTP.CookieExpiry) * time.Second) cookie = http.Cookie{ Name: "session", @@ -85,7 +85,7 @@ func (s *Server) httpHandleLogin(writer http.ResponseWriter, request *http.Reque http.SetCookie(writer, &cookie) - _, err = s.Database.Exec(request.Context(), "INSERT INTO sessions (user_id, session_id) VALUES ($1, $2)", userID, cookieValue) + _, err = s.database.Exec(request.Context(), "INSERT INTO sessions (user_id, session_id) VALUES ($1, $2)", userID, cookieValue) if err != nil { errorPage500(writer, params, "Error inserting session: "+err.Error()) return -- cgit v1.2.3