From 00c197e2ee61561610312e8ea8d8323d8f972023 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Thu, 24 Jan 2019 06:11:37 -0500 Subject: [PATCH] owner_new.go: perform email check before processing --- api/owner_new.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/owner_new.go b/api/owner_new.go index 66b1321..26a9b9a 100644 --- a/api/owner_new.go +++ b/api/owner_new.go @@ -16,6 +16,10 @@ func ownerNew(email string, name string, password string) (string, error) { return "", errorNewOwnerForbidden } + if _, err := ownerGetByEmail(email); err == nil { + return "", errorEmailAlreadyExists + } + ownerHex, err := randomHex(32) if err != nil { logger.Errorf("cannot generate ownerHex: %v", err)