diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 21:47:44 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 21:47:44 +0800 |
commit | efa6f33b4c67f64a4a8d8cd723b9bbc9494fc735 (patch) | |
tree | c4075c78bc4126d764f91ec68931c34281913dcc /http_handle_login.go | |
parent | Add missing copyright headers (diff) | |
download | forge-efa6f33b4c67f64a4a8d8cd723b9bbc9494fc735.tar.gz forge-efa6f33b4c67f64a4a8d8cd723b9bbc9494fc735.tar.zst forge-efa6f33b4c67f64a4a8d8cd723b9bbc9494fc735.zip |
Unexport fields in Serverv0.1.24
Diffstat (limited to 'http_handle_login.go')
-rw-r--r-- | http_handle_login.go | 6 |
1 files changed, 3 insertions, 3 deletions
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 |