π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[server] Skip sending ott during signup when registrations are disabled (#4563)
Neeraj Guptaa1e97239c355
diff --git a/server/configurations/local.yaml b/server/configurations/local.yamlindex f39fbcc283..cd061cfd06 100644--- a/server/configurations/local.yaml+++ b/server/configurations/local.yaml@@ -331,10 +331,8 @@ internal:admin:# If set to true, users will not be able to register a new account.#- # Account creation will fail when entering the email ott. This doesn't- # affect the clients, users can still go through the registration flow, but- # when entering the ott they received via mail, they will get an- # unauthorized error and thus cannot create new accounts.+ # During sign up, the client will get an unauthorized error and+ # thus cannot create new accounts.disable-registration: false# Replication configdiff --git a/server/pkg/controller/user/userauth.go b/server/pkg/controller/user/userauth.goindex 6721903518..86828d1cee 100644--- a/server/pkg/controller/user/userauth.go+++ b/server/pkg/controller/user/userauth.go@@ -93,6 +93,9 @@ func (c *UserController) SendEmailOTT(context *gin.Context, email string, purposif isComplete && purpose == ente.SignUpOTTPurpose {return stacktrace.Propagate(ente.ErrUserAlreadyRegistered, "user has already completed sign up process")}+ if purpose == ente.SignUpOTTPurpose && viper.GetBool("internal.disable-registration") {+ return stacktrace.Propagate(ente.ErrPermissionDenied, "registration is disabled")+ }if !isComplete && purpose == ente.LoginOTTPurpose {return stacktrace.Propagate(ente.ErrUserNotRegistered, "user has not completed sign up process")}@@ -362,6 +365,7 @@ func (c *UserController) onVerificationSuccess(context *gin.Context, email strinuserID, err := c.UserRepo.GetUserIDWithEmail(email)if err != nil {if errors.Is(err, sql.ErrNoRows) {+ // Keep this check as users can still trigger ott via other means that can lead to this code pathif viper.GetBool("internal.disable-registration") {return ente.EmailAuthorizationResponse{}, stacktrace.Propagate(ente.ErrPermissionDenied, "")} else {