diff --git a/main.go b/main.go index 3b981a2..710a1b9 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,7 @@ func UsernameAvailable(username string) bool { var tmp string u := strings.ToLower(username) - q := fmt.Sprintf("select username from %s_auth where username ILIKE $1", c.TablePrefix) + q := fmt.Sprintf("select username from %s_auth where username = $1", c.TablePrefix) err := c.db.Get(&tmp, q, u) if err == sql.ErrNoRows { return true @@ -95,8 +95,8 @@ func Register(username, email, ip string) bool { return true } log.Printf("scsusers.Register: Failed to send registration email, deleting user %s\n", username) - q = fmt.Sprintf("delete from %s_auth where username ILIKE $1 AND password=$2", c.TablePrefix) - _, err = c.db.Exec(q, username, string(crypt)) + q = fmt.Sprintf("delete from %s_auth where username = $1 AND password=$2", c.TablePrefix) + _, err = c.db.Exec(q, u, string(crypt)) if err != nil { log.Printf("scsusers.Register: Failed to delete new user %s: %s\n", username, err.Error()) }