This commit is contained in:
parent
bc9ea818eb
commit
b41f005d9e
9 changed files with 110 additions and 92 deletions
|
|
@ -0,0 +1,18 @@
|
|||
defmodule Mv.Membership.JoinRequest.Changes.SetConfirmServerMetadata do
|
||||
@moduledoc """
|
||||
Ash Change that sets server-side metadata for the public :confirm action.
|
||||
|
||||
Client may only send :email, :confirmation_token_hash, :payload (concept §2.3.2).
|
||||
This change sets: status, submitted_at, source, schema_version so they cannot be forged.
|
||||
"""
|
||||
use Ash.Resource.Change
|
||||
|
||||
@impl true
|
||||
def change(changeset, _opts, _context) do
|
||||
changeset
|
||||
|> Ash.Changeset.force_change_attribute(:status, "submitted")
|
||||
|> Ash.Changeset.force_change_attribute(:submitted_at, DateTime.utc_now())
|
||||
|> Ash.Changeset.force_change_attribute(:source, "public_join")
|
||||
|> Ash.Changeset.force_change_attribute(:schema_version, 1)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue