lowercase companyname and fix email exists
This commit is contained in:
parent
149eaeb7f8
commit
971f0e47a0
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user