fix user registration bug

This commit is contained in:
Hayden 2023-02-14 14:44:42 -09:00
parent dfdf98c82b
commit 25ef2d0f51
No known key found for this signature in database
GPG key ID: 17CF79474E257545

View file

@ -1,6 +1,7 @@
package v1 package v1
import ( import (
"fmt"
"net/http" "net/http"
"github.com/google/uuid" "github.com/google/uuid"
@ -27,8 +28,8 @@ func (ctrl *V1Controller) HandleUserRegistration() server.HandlerFunc {
return validate.NewRequestError(err, http.StatusInternalServerError) return validate.NewRequestError(err, http.StatusInternalServerError)
} }
if !ctrl.allowRegistration && regData.GroupToken == "" { if ctrl.allowRegistration == false && regData.GroupToken == "" {
return validate.NewRequestError(nil, http.StatusForbidden) return validate.NewRequestError(fmt.Errorf("user registration disabled"), http.StatusForbidden)
} }
_, err := ctrl.svc.User.RegisterUser(r.Context(), regData) _, err := ctrl.svc.User.RegisterUser(r.Context(), regData)