Seeds: only admin gets password; additional users without password

- Additional users (hans, greta, maria, thomas) created without admin_set_password.
- Removed no-password@example.de user.
This commit is contained in:
Moritz 2026-02-04 11:06:59 +01:00
parent 541c79e501
commit b6d1a27bc9

View file

@ -228,7 +228,7 @@ case Accounts.User
|> Ash.update!(authorize?: false)
{:ok, nil} ->
# User doesn't exist - create admin user with password
# User doesn't exist - create admin user and set password (so Password column shows "Enabled")
# Use authorize?: false for bootstrap - no admin user exists yet to use as actor
Accounts.create_user!(%{email: admin_email},
upsert?: true,
@ -457,7 +457,8 @@ Enum.each(member_attrs_list, fn member_attrs ->
end
end)
# Create additional users for user-member linking examples
# Create additional users for user-member linking examples (no password by default)
# Only admin gets a password (admin_set_password when created); all other users have no password.
additional_users = [
%{email: "hans.mueller@example.de"},
%{email: "greta.schmidt@example.de"},
@ -467,15 +468,12 @@ additional_users = [
created_users =
Enum.map(additional_users, fn user_attrs ->
# Use admin user as actor for additional user creation (not bootstrap)
user =
Accounts.create_user!(user_attrs,
upsert?: true,
upsert_identity: :unique_email,
actor: admin_user_with_role
)
|> Ash.Changeset.for_update(:admin_set_password, %{password: "testpassword"})
|> Ash.update!(actor: admin_user_with_role)
# Reload user to ensure all fields (including member_id) are loaded
Accounts.User