This commit is contained in:
Your Name 2020-07-18 07:56:42 -04:00
parent 187d9d2ce2
commit 6d43965c1f
1 changed files with 3 additions and 3 deletions

View File

@ -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())
}