lowercase companyname and fix email exists
This commit is contained in:
parent
149eaeb7f8
commit
971f0e47a0
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"multitenantStack/models"
|
"multitenantStack/models"
|
||||||
companydb "multitenantStack/services/companydb"
|
companydb "multitenantStack/services/companydb"
|
||||||
|
"strings"
|
||||||
|
|
||||||
tokenTools "multitenantStack/services/tokenTools"
|
tokenTools "multitenantStack/services/tokenTools"
|
||||||
"time"
|
"time"
|
||||||
@ -168,6 +169,7 @@ func (c *AuthController) Register() {
|
|||||||
companyname := c.GetString("companyname")
|
companyname := c.GetString("companyname")
|
||||||
|
|
||||||
companyname = sanitize.BaseName(companyname)
|
companyname = sanitize.BaseName(companyname)
|
||||||
|
companyname = strings.ToLower(companyname)
|
||||||
companyname = fmt.Sprintf("company_%s", companyname)
|
companyname = fmt.Sprintf("company_%s", companyname)
|
||||||
|
|
||||||
if email == "" || password == "" || companyname == "" || username == "" {
|
if email == "" || password == "" || companyname == "" || username == "" {
|
||||||
@ -189,7 +191,7 @@ func (c *AuthController) Register() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ucmExists, err := models.GetUserCompanyMapByEmail(o, email)
|
ucmExists, err := models.GetUserCompanyMapByEmail(o, email)
|
||||||
if err != nil && ucmExists != nil {
|
if err != nil || ucmExists != nil {
|
||||||
c.ServeJSONError("Error: Email exists!")
|
c.ServeJSONError("Error: Email exists!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user