Show error messages in UI if something goes wrong

This commit is contained in:
2024-10-04 16:06:33 +02:00
parent aec829ad85
commit 863581f590
12 changed files with 211 additions and 271 deletions

View File

@@ -99,8 +99,8 @@ func Login(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFunc {
userName := r.PostFormValue("username")
password := r.PostFormValue("password")
id, ok := db.GetID(userName)
if !ok {
id := db.GetID(userName)
if id == 0 {
http.Error(w, fmt.Sprintf("no such user: %v", userName), http.StatusBadRequest)
return
}