feat(auth): Add option to disable registration and tenant creation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.secnex.io/secnex/auth-api/config"
|
||||
"git.secnex.io/secnex/auth-api/services"
|
||||
"git.secnex.io/secnex/auth-api/utils"
|
||||
"github.com/go-playground/validator/v10"
|
||||
@@ -16,6 +17,11 @@ type RegisterRequest struct {
|
||||
}
|
||||
|
||||
func RegisterController(c *fiber.Ctx) error {
|
||||
if !config.CONFIG.AllowRegistration {
|
||||
return utils.NewErrorResponse(fiber.StatusForbidden, &fiber.Map{
|
||||
"message": "Registration is not allowed",
|
||||
}).Send(c)
|
||||
}
|
||||
var request RegisterRequest
|
||||
if err := c.BodyParser(&request); err != nil {
|
||||
return utils.NewErrorResponse(fiber.StatusBadRequest, &fiber.Map{
|
||||
|
||||
Reference in New Issue
Block a user