From 971f0e47a0e8b328bb5f19107cebdd3b7b7966c2 Mon Sep 17 00:00:00 2001 From: Lukas Bachschwell Date: Wed, 14 Nov 2018 19:08:04 +0100 Subject: [PATCH] lowercase companyname and fix email exists --- controllers/auth.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 }