defmodule Garagem.Seguranca.Usuario do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
extensions: [AshAuthentication]
attributes do
uuid_primary_key :id
attribute :email, :ci_string, allow_nil?: false
attribute :hashed_password, :string, allow_nil?: false, sensitive?: true
end
authentication do
api Garagem.Seguranca
strategies do
password :password do
identity_field :email
sign_in_tokens_enabled? true
end
end
tokens do
enabled? true
token_resource Garagem.Seguranca.Token
signing_secret Garagem.Seguranca.Secrets
end
end
postgres do
table "usuarios"
repo Garagem.Repo
end
identities do
identity :unique_email, [:email]
end
end
defmodule Garagem.Seguranca.Usuario do
use Ash.Resource,
data_layer: AshPostgres.DataLayer,
extensions: [AshAuthentication]
attributes do
uuid_primary_key :id
attribute :email, :ci_string, allow_nil?: false
attribute :hashed_password, :string, allow_nil?: false, sensitive?: true
end
authentication do
api Garagem.Seguranca
strategies do
password :password do
identity_field :email
sign_in_tokens_enabled? true
end
end
tokens do
enabled? true
token_resource Garagem.Seguranca.Token
signing_secret Garagem.Seguranca.Secrets
end
end
postgres do
table "usuarios"
repo Garagem.Repo
end
identities do
identity :unique_email, [:email]
end
end