don't allow reassigning token

This commit is contained in:
shibao 2022-02-16 20:52:42 -05:00
parent eb6bab0fd9
commit bd964105b4

View File

@ -50,7 +50,7 @@ defmodule Cannery.Invites.Invite do
@spec update_changeset(t() | new_invite(), attrs :: map()) :: Changeset.t(t() | new_invite())
def update_changeset(invite, attrs) do
invite
|> cast(attrs, [:name, :token, :uses_left, :disabled_at])
|> cast(attrs, [:name, :uses_left, :disabled_at])
|> validate_required([:name, :token, :user_id])
|> validate_number(:uses_left, greater_than_or_equal_to: 0)
end