|
|
|
@ -3,6 +3,7 @@ defmodule DecentralisedBookIndex.Generators do
|
|
|
|
|
|
|
|
|
|
use Ash.Generator
|
|
|
|
|
alias DecentralisedBookIndex.Metadata
|
|
|
|
|
alias DecentralisedBookIndex.Accounts
|
|
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
|
Generates user changesets with the `:register_with_password` action.
|
|
|
|
@ -19,6 +20,10 @@ defmodule DecentralisedBookIndex.Generators do
|
|
|
|
|
password_confirmation: "password"
|
|
|
|
|
],
|
|
|
|
|
overrides: opts,
|
|
|
|
|
after_action: fn user ->
|
|
|
|
|
role = opts[:role] || :user
|
|
|
|
|
Accounts.User.set_role!(user, role, authorize?: false)
|
|
|
|
|
end,
|
|
|
|
|
authorize?: false
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|