lowercase companyname and fix email exists

This commit is contained in:
Lukas Bachschwell 2018-11-14 19:08:04 +01:00
parent 149eaeb7f8
commit 971f0e47a0
1 changed files with 3 additions and 1 deletions

View File

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