Skip to content

Commit

Permalink
chore: add false filter on nil identity_field
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Aug 12, 2024
1 parent ccd0eb0 commit 74b0c47
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@ defmodule AshAuthentication.Strategy.Password.SignInPreparation do
identity_field = strategy.identity_field
identity = Query.get_argument(query, identity_field)

query =
if is_nil(identity) do
# This will fail due to the argument being `nil`, so this is just a formality
Query.filter(false)
else
Query.filter(^ref(identity_field) == ^identity)
end

query
|> Query.filter(^ref(identity_field) == ^identity)
|> check_sign_in_token_configuration(strategy)
|> Query.before_action(fn query ->
Ash.Query.ensure_selected(query, [strategy.hashed_password_field])
Expand Down

0 comments on commit 74b0c47

Please sign in to comment.