This commit is contained in:
parent
4e6f5a517a
commit
e74e7cbd31
3 changed files with 307 additions and 69 deletions
|
|
@ -66,10 +66,15 @@ defmodule Mv.Accounts.User do
|
|||
|
||||
create :create_user do
|
||||
accept [:email, :member_id]
|
||||
argument :member, :map
|
||||
change manage_relationship(:member, type: :create)
|
||||
end
|
||||
|
||||
update :update_user do
|
||||
require_atomic? false
|
||||
accept [:email, :member_id]
|
||||
argument :member, :map
|
||||
change manage_relationship(:member, on_match: :update, on_no_match: :create)
|
||||
end
|
||||
|
||||
# Admin action for direct password changes in admin panel
|
||||
|
|
@ -118,6 +123,16 @@ defmodule Mv.Accounts.User do
|
|||
|> Ash.Changeset.change_attribute(:oidc_id, user_info["sub"] || user_info["id"])
|
||||
end
|
||||
end
|
||||
|
||||
create :register_with_password do
|
||||
accept [:email]
|
||||
argument :password, :string, allow_nil?: false, sensitive?: true
|
||||
argument :password_confirmation, :string, allow_nil?: false, sensitive?: true
|
||||
argument :member, :map
|
||||
change AshAuthentication.Strategy.Password.HashPasswordChange
|
||||
change AshAuthentication.GenerateTokenChange
|
||||
change manage_relationship(:member, type: :create)
|
||||
end
|
||||
end
|
||||
|
||||
# Global validations - applied to all relevant actions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue