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
This commit is contained in:
Livio Spring
2026-03-30 15:31:51 +00:00
committed by GitHub
parent b145f1c85a
commit 0390e324e4
+5 -1
View File
@@ -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)