update deps
Some checks failed
continuous-integration/drone/tag Build is failing
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-04-05 00:13:01 +00:00
parent 449a92e4b7
commit 37d101a71e
130 changed files with 1748 additions and 12180 deletions

View File

@ -17,7 +17,7 @@ defmodule Cannery.Accounts.Invite do
has_many :users, User
timestamps()
timestamps(type: :utc_datetime)
end
@type t :: %__MODULE__{

View File

@ -21,6 +21,7 @@ defmodule Cannery.Accounts.User do
field :email, :string
field :password, :string, virtual: true
field :hashed_password, :string
field :current_password, :string, virtual: true, redact: true
field :confirmed_at, :naive_datetime
field :role, Ecto.Enum, values: [:admin, :user], default: :user
field :locale, :string
@ -29,7 +30,7 @@ defmodule Cannery.Accounts.User do
belongs_to :invite, Invite
timestamps()
timestamps(type: :utc_datetime)
end
@type t :: %User{
@ -193,6 +194,8 @@ defmodule Cannery.Accounts.User do
"""
@spec validate_current_password(changeset(), String.t()) :: changeset()
def validate_current_password(changeset, password) do
changeset = cast(changeset, %{current_password: password}, [:current_password])
if valid_password?(changeset.data, password),
do: changeset,
else: changeset |> add_error(:current_password, dgettext("errors", "is not valid"))