diff --git a/controllers/auth.go b/controllers/auth.go index e1d0f07..1c38f73 100644 --- a/controllers/auth.go +++ b/controllers/auth.go @@ -4,6 +4,7 @@ import ( "fmt" "multitenantStack/models" companydb "multitenantStack/services/companydb" + "strings" tokenTools "multitenantStack/services/tokenTools" "time" @@ -168,6 +169,7 @@ func (c *AuthController) Register() { companyname := c.GetString("companyname") companyname = sanitize.BaseName(companyname) + companyname = strings.ToLower(companyname) companyname = fmt.Sprintf("company_%s", companyname) if email == "" || password == "" || companyname == "" || username == "" { @@ -189,7 +191,7 @@ func (c *AuthController) Register() { } ucmExists, err := models.GetUserCompanyMapByEmail(o, email) - if err != nil && ucmExists != nil { + if err != nil || ucmExists != nil { c.ServeJSONError("Error: Email exists!") return }