Allow email to login as well
alex wennerberg alex@alexwennerberg.com
Thu, 29 Oct 2020 18:29:36 -0700
2 files changed,
2 insertions(+),
2 deletions(-)
M
http.go
→
http.go
@@ -230,7 +230,7 @@ } else if r.Method == "POST" {
r.ParseForm() name := r.Form.Get("username") password := r.Form.Get("password") - row := DB.QueryRow("SELECT password_hash, active, admin FROM user where username = $1", name) + row := DB.QueryRow("SELECT password_hash, active, admin FROM user where username = $1 OR email = $1", name) var db_password []byte var active bool var isAdmin bool
M
templates/login.html
→
templates/login.html
@@ -2,7 +2,7 @@ {{template "header" .}}
<h1>Login</h1> <form action="/login" method="post"> <p> - <label for="username">Username</label> + <label for="username">Username or Email</label> <input id="username" name="username" size="32" type="text" value="" /> </p> <p>