aboutsummaryrefslogtreecommitdiff
path: root/http_handle_login.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http_handle_login.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/http_handle_login.go b/http_handle_login.go
index ea1dbae..10bfdcd 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 = database.QueryRow(request.Context(),
+ err = s.database.QueryRow(request.Context(),
"SELECT id, COALESCE(password, '') FROM users WHERE username = $1",
username,
).Scan(&userID, &passwordHash)
@@ -85,7 +85,7 @@ func (s *server) httpHandleLogin(writer http.ResponseWriter, request *http.Reque
http.SetCookie(writer, &cookie)
- _, err = 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