add internal.disable-registration to config
This commit is contained in:
@@ -321,6 +321,9 @@ internal:
|
||||
# the "admin" instead of "admins". This can be useful e.g. when wishing to
|
||||
# pass the admin as an environment variable.
|
||||
admin:
|
||||
# If set to true, users will not be able to register a new account.
|
||||
# Account creation will fail when entering the email ott
|
||||
disable-registration: false
|
||||
|
||||
# Replication config
|
||||
#
|
||||
|
||||
@@ -362,9 +362,13 @@ func (c *UserController) onVerificationSuccess(context *gin.Context, email strin
|
||||
userID, err := c.UserRepo.GetUserIDWithEmail(email)
|
||||
if err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
userID, _, err = c.createUser(email, source)
|
||||
if err != nil {
|
||||
return ente.EmailAuthorizationResponse{}, stacktrace.Propagate(err, "")
|
||||
if !viper.GetBool("internal.disable-registration") {
|
||||
userID, _, err = c.createUser(email, source)
|
||||
if err != nil {
|
||||
return ente.EmailAuthorizationResponse{}, stacktrace.Propagate(err, "")
|
||||
}
|
||||
} else {
|
||||
return ente.EmailAuthorizationResponse{}, stacktrace.Propagate(ente.ErrPermissionDenied, "")
|
||||
}
|
||||
} else {
|
||||
return ente.EmailAuthorizationResponse{}, stacktrace.Propagate(err, "")
|
||||
|
||||
Reference in New Issue
Block a user