owner_new.go: perform email check before processing

This commit is contained in:
Adhityaa Chandrasekar 2019-01-24 06:11:37 -05:00
parent c6a98d93e4
commit 00c197e2ee

View File

@ -16,6 +16,10 @@ func ownerNew(email string, name string, password string) (string, error) {
return "", errorNewOwnerForbidden return "", errorNewOwnerForbidden
} }
if _, err := ownerGetByEmail(email); err == nil {
return "", errorEmailAlreadyExists
}
ownerHex, err := randomHex(32) ownerHex, err := randomHex(32)
if err != nil { if err != nil {
logger.Errorf("cannot generate ownerHex: %v", err) logger.Errorf("cannot generate ownerHex: %v", err)