api: add option to forbid new owner registrations
Closes https://gitlab.com/commento/commento-ce/issues/10
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -11,6 +12,10 @@ func ownerNew(email string, name string, password string) (string, error) {
|
||||
return "", errorMissingField
|
||||
}
|
||||
|
||||
if os.Getenv("FORBID_NEW_OWNERS") == "true" {
|
||||
return "", errorNewOwnerForbidden
|
||||
}
|
||||
|
||||
ownerHex, err := randomHex(32)
|
||||
if err != nil {
|
||||
logger.Errorf("cannot generate ownerHex: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user