From 25ef2d0f5140b39a69d2f0ee8bcce529d9437831 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Tue, 14 Feb 2023 14:44:42 -0900 Subject: [PATCH] fix user registration bug --- backend/app/api/handlers/v1/v1_ctrl_user.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/app/api/handlers/v1/v1_ctrl_user.go b/backend/app/api/handlers/v1/v1_ctrl_user.go index 565a723..c70672f 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_user.go +++ b/backend/app/api/handlers/v1/v1_ctrl_user.go @@ -1,6 +1,7 @@ package v1 import ( + "fmt" "net/http" "github.com/google/uuid" @@ -27,8 +28,8 @@ func (ctrl *V1Controller) HandleUserRegistration() server.HandlerFunc { return validate.NewRequestError(err, http.StatusInternalServerError) } - if !ctrl.allowRegistration && regData.GroupToken == "" { - return validate.NewRequestError(nil, http.StatusForbidden) + if ctrl.allowRegistration == false && regData.GroupToken == "" { + return validate.NewRequestError(fmt.Errorf("user registration disabled"), http.StatusForbidden) } _, err := ctrl.svc.User.RegisterUser(r.Context(), regData)