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 0a87b71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .tool-versions

This file was deleted.

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(query, false)
else
Query.filter(query, ^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 0a87b71

Please sign in to comment.