aboutsummaryrefslogtreecommitdiff
path: root/http_handle_login.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-22 13:59:00 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-22 13:59:00 +0800
commit1f185f329bb82c87b250fb2312ae873d69a20d38 (patch)
tree892ad487e7e1154fcb71fbe05acf9e583592e96b /http_handle_login.go
parentVariable name lengths (diff)
downloadforge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.gz
forge-1f185f329bb82c87b250fb2312ae873d69a20d38.tar.zst
forge-1f185f329bb82c87b250fb2312ae873d69a20d38.zip
Use a custom errPage500
Diffstat (limited to 'http_handle_login.go')
-rw-r--r--http_handle_login.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/http_handle_login.go b/http_handle_login.go
index ed56e0a..424c42f 100644
--- a/http_handle_login.go
+++ b/http_handle_login.go
@@ -44,7 +44,7 @@ func httpHandleLogin(writer http.ResponseWriter, request *http.Request, params m
renderTemplate(writer, "login", params)
return
}
- http.Error(writer, "Error querying user information: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error querying user information: "+err.Error())
return
}
if passwordHash == "" {
@@ -54,7 +54,7 @@ func httpHandleLogin(writer http.ResponseWriter, request *http.Request, params m
}
if passwordMatches, err = argon2id.ComparePasswordAndHash(password, passwordHash); err != nil {
- http.Error(writer, "Error comparing password and hash: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error comparing password and hash: "+err.Error())
return
}
@@ -65,7 +65,7 @@ func httpHandleLogin(writer http.ResponseWriter, request *http.Request, params m
}
if cookieValue, err = randomUrlsafeStr(16); err != nil {
- http.Error(writer, "Error getting random string: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error getting random string: "+err.Error())
return
}
@@ -86,7 +86,7 @@ func httpHandleLogin(writer http.ResponseWriter, request *http.Request, params m
_, err = database.Exec(request.Context(), "INSERT INTO sessions (user_id, session_id) VALUES ($1, $2)", userID, cookieValue)
if err != nil {
- http.Error(writer, "Error inserting session: "+err.Error(), http.StatusInternalServerError)
+ errorPage500(writer, params, "Error inserting session: "+err.Error())
return
}