Skip to content

Commit

Permalink
fix: set options earlier in magic link/oauth2
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Aug 9, 2024
1 parent 652983b commit ccd0eb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions lib/ash_authentication/strategies/magic_link/actions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ defmodule AshAuthentication.Strategy.MagicLink.Actions do
strategy.resource
|> Query.new()
|> Query.set_context(%{private: %{ash_authentication?: true}})
|> Query.for_read(strategy.request_action_name, params)
|> Ash.read(options)
|> Query.for_read(strategy.request_action_name, params, options)
|> Ash.read()
|> case do
{:ok, _} -> :ok
{:error, reason} -> {:error, reason}
Expand All @@ -44,8 +44,8 @@ defmodule AshAuthentication.Strategy.MagicLink.Actions do
strategy.resource
|> Query.new()
|> Query.set_context(%{private: %{ash_authentication?: true}})
|> Query.for_read(strategy.sign_in_action_name, params)
|> Ash.read(options)
|> Query.for_read(strategy.sign_in_action_name, params, options)
|> Ash.read()
|> case do
{:ok, [user]} ->
{:ok, user}
Expand Down
16 changes: 10 additions & 6 deletions lib/ash_authentication/strategies/oauth2/actions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ defmodule AshAuthentication.Strategy.OAuth2.Actions do
ash_authentication?: true
}
})
|> Query.for_read(strategy.sign_in_action_name, params)
|> Ash.read(options)
|> Query.for_read(strategy.sign_in_action_name, params, options)
|> Ash.read()
|> case do
{:ok, [user]} ->
{:ok, user}
Expand Down Expand Up @@ -105,11 +105,15 @@ defmodule AshAuthentication.Strategy.OAuth2.Actions do
ash_authentication?: true
}
})
|> Changeset.for_create(strategy.register_action_name, params,
upsert?: true,
upsert_identity: action.upsert_identity
|> Changeset.for_create(
strategy.register_action_name,
params,
Keyword.merge(options,
upsert?: true,
upsert_identity: action.upsert_identity
)
)
|> Ash.create(options)
|> Ash.create()
end

def register(%OAuth2{} = strategy, _params, _options),
Expand Down

0 comments on commit ccd0eb0

Please sign in to comment.