diff --git a/cmd/webserver.go b/cmd/webserver.go index d2cb5552..85987a98 100644 --- a/cmd/webserver.go +++ b/cmd/webserver.go @@ -151,8 +151,6 @@ func startWebServer(c *cli.Context) error { if config.EnableUserRegister { apiRoute.POST("/register.json", bindApi(api.Users.UserRegisterHandler)) - } else { - apiRoute.POST("/register.json", bindApi(api.Users.UserRegistrationNotAllowed)) } if config.EnableDataExport { diff --git a/pkg/api/users.go b/pkg/api/users.go index 729a38ee..59cc8e58 100644 --- a/pkg/api/users.go +++ b/pkg/api/users.go @@ -29,7 +29,7 @@ var ( // UserRegisterHandler saves a new user by request parameters func (a *UsersApi) UserRegisterHandler(c *core.Context) (interface{}, *errs.Error) { if !settings.Container.Current.EnableUserRegister { - return a.UserRegistrationNotAllowed(c) + return nil, errs.ErrUserRegistrationNotAllowed } var userRegisterReq models.UserRegisterRequest @@ -81,11 +81,6 @@ func (a *UsersApi) UserRegisterHandler(c *core.Context) (interface{}, *errs.Erro return authResp, nil } -// UserRegistrationNotAllowed returns user registration not allowed error -func (a *UsersApi) UserRegistrationNotAllowed(c *core.Context) (interface{}, *errs.Error) { - return nil, errs.ErrUserRegistrationNotAllowed -} - // UserProfileHandler returns user profile of current user func (a *UsersApi) UserProfileHandler(c *core.Context) (interface{}, *errs.Error) { uid := c.GetCurrentUid()