mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-19 21:03:23 +12:00
fix(Password.Transformer): don't force users to define a hashed_password
argument to the register action. (#192)
I'm not sure why I added that. Seems wrong.
This commit is contained in:
parent
311ff2a42a
commit
aa57d8ab51
1 changed files with 0 additions and 22 deletions
|
@ -153,7 +153,6 @@ defmodule AshAuthentication.Strategy.Password.Transformer do
|
|||
|
||||
defp validate_register_action(dsl_state, strategy) do
|
||||
with {:ok, action} <- validate_action_exists(dsl_state, strategy.register_action_name),
|
||||
:ok <- validate_allow_nil_input(action, strategy.hashed_password_field),
|
||||
:ok <- validate_password_argument(action, strategy.password_field, true),
|
||||
:ok <-
|
||||
validate_password_argument(
|
||||
|
@ -171,27 +170,6 @@ defmodule AshAuthentication.Strategy.Password.Transformer do
|
|||
end
|
||||
end
|
||||
|
||||
defp validate_allow_nil_input(action, field) do
|
||||
allowed_nil_fields =
|
||||
action
|
||||
|> Map.get(:arguments, [])
|
||||
|> Stream.filter(&(&1.allow_nil? == true))
|
||||
|> Stream.map(& &1.name)
|
||||
|> Stream.concat(Map.get(action, :allow_nil_input, []))
|
||||
|> Enum.into(MapSet.new())
|
||||
|
||||
if MapSet.member?(allowed_nil_fields, field) do
|
||||
:ok
|
||||
else
|
||||
{:error,
|
||||
DslError.exception(
|
||||
path: [:actions, :allow_nil_input],
|
||||
message:
|
||||
"Expected the action `#{inspect(action.name)}` to allow nil input for the field `#{inspect(field)}`"
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
defp validate_password_argument(action, field, true) do
|
||||
with :ok <- validate_action_argument_option(action, field, :type, [Ash.Type.String]) do
|
||||
validate_action_argument_option(action, field, :sensitive?, [true])
|
||||
|
|
Loading…
Reference in a new issue