From 0390e324e44f7b03a1be28ad9b50151e24b8c619 Mon Sep 17 00:00:00 2001 From: Livio Spring <9405495+livio-a@users.noreply.github.com> Date: Mon, 30 Mar 2026 17:31:51 +0200 Subject: [PATCH] fix: do not send init mails for admins on instance setup (#11744) # Which Problems Are Solved Currently when setting up an instance, for example from the customer portal through system api, an instance is created together with an administrator. If no admin user is specified the default user from the runtime configuration is automatically added. For the new onboarding, we can to create instances without prompting the user to set up a complete account right on start, but the current behavior of the API prevents this, resp. the created account would fallback to the default user or password. By providing an empty `password` field in the `owner_password` in the `AddInstanceRequest` or `huiman.password` in the `CreateInstanceRequest`, it's already possible to create an account without password. Until now this however ended up in an initial mail to be sent to the user to finalize their account setup. # How the Problems Are Solved We simply set the `allowInitMail` to false in the `AddHumanCommand` for setting up the admins. This will prevent an email to be sent out immediately and gives us the possibility to use the invite flow later on. # Additional Changes None # Additional Context - required for https://github.com/zitadel/website/issues/1611 - backport to v4.x --- internal/command/instance.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/command/instance.go b/internal/command/instance.go index 5b69ee9b5..94f4583b4 100644 --- a/internal/command/instance.go +++ b/internal/command/instance.go @@ -648,7 +648,11 @@ func setupAdmins(commands *Commands, human.ID = humanUserID *validations = append(*validations, - commands.AddHumanCommand(human, orgAgg.ID, commands.userPasswordHasher, commands.userEncryption, true), + // We no longer send an init mail anymore even if no auth method is set. + // This allows us to create the initial user without a password and send them an invitation mail if needed later on, + // which will be a necessary step for the new onboarding flow in the customer portal. + // Also since login v2 is now the default, we anyway wouldn't be able to handle the init link properly anymore. + commands.AddHumanCommand(human, orgAgg.ID, commands.userPasswordHasher, commands.userEncryption, false), ) setupAdminMembers(commands, validations, instanceAgg, orgAgg, humanUserID)