all repos — flounder @ 729f3dd39dab2712dfb264dd67fb8b4aa1d7605a

A small site builder for the Gemini protocol

Better error handling on nonexistent user
alex wennerberg alex@alexwennerberg.com
Thu, 14 Jan 2021 20:41:54 -0800
commit

729f3dd39dab2712dfb264dd67fb8b4aa1d7605a

parent

d2a93d9ebce46334ed7b05fc8d5691c70094de9f

1 files changed, 10 insertions(+), 1 deletions(-)

jump to
M http.gohttp.go

@@ -379,7 +379,16 @@ var active bool

var isAdmin bool err := row.Scan(&username, &db_password, &active, &isAdmin) if err != nil { - panic(err) + if strings.Contains(err.Error(), "no rows") { + data := struct { + Error string + Config Config + }{"Username or email '" + name + "' does not exist", c} + t.ExecuteTemplate(w, "login.html", data) + return + } else { + panic(err) + } } if db_password != nil && !active { data := struct {