Add the trim as well for the user creation

This commit is contained in:
Las Zenow 2018-04-26 11:13:08 +00:00
parent f6cf82fcb3
commit 645c4ce217

View file

@ -1,6 +1,8 @@
package trantor
import (
"strings"
log "github.com/cihub/seelog"
"gitlab.com/trantor/trantor/lib/database"
@ -42,7 +44,7 @@ func createUserHandler(h handler) {
} else if pass == "" {
h.sess.Notify("Registration error!", "The password can't be empty", "error")
} else {
user := h.r.FormValue("user")
user := strings.TrimSpace(h.r.FormValue("user"))
err := h.db.AddUser(user, pass)
if err == nil {
h.sess.Notify("Account created!", "Welcome "+user+". Now you can login", "success")