feat(users): lowercase username

This commit is contained in:
Anthony Lapenna
2020-05-09 10:18:47 +12:00
parent 8046fb0438
commit b4e38b6b38
5 changed files with 46 additions and 15 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ package users
import (
"net/http"
"strings"
"github.com/asaskevich/govalidator"
httperror "github.com/portainer/libhttp/error"
@@ -43,7 +44,7 @@ func (handler *Handler) adminInit(w http.ResponseWriter, r *http.Request) *httpe
}
user := &portainer.User{
Username: payload.Username,
Username: strings.ToLower(payload.Username),
Role: portainer.AdministratorRole,
PortainerAuthorizations: portainer.DefaultPortainerAuthorizations(),
}