Skip to content

Commit

Permalink
chore: Fix dialyzer failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimsynz committed Aug 18, 2024
1 parent 01d3fde commit 02f8a85
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 25 deletions.
15 changes: 2 additions & 13 deletions lib/ash_authentication/add_ons/confirmation/transformer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,8 @@ defmodule AshAuthentication.AddOn.Confirmation.Transformer do
with {:ok, resource} <- persisted_option(dsl_state, :module),
{:ok, attribute} <- find_attribute(dsl_state, strategy.confirmed_at_field),
:ok <- validate_attribute_option(attribute, resource, :writable?, [true]),
:ok <- validate_attribute_option(attribute, resource, :allow_nil?, [true]),
:ok <- validate_attribute_option(attribute, resource, :type, [Type.UtcDatetimeUsec]) do
:ok
else
:error ->
{:error,
DslError.exception(
path: [:confirmation],
message: "The `confirmed_at_field` option must be set."
)}

{:error, reason} ->
{:error, reason}
:ok <- validate_attribute_option(attribute, resource, :allow_nil?, [true]) do
validate_attribute_option(attribute, resource, :type, [Type.UtcDatetimeUsec])
end
end

Expand Down
7 changes: 2 additions & 5 deletions lib/ash_authentication/strategies/oauth2/identity_change.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ defmodule AshAuthentication.Strategy.OAuth2.IdentityChange do
changeset
|> Changeset.after_action(fn changeset, user ->
with {:ok, user_id_attribute_name} <-
strategy.identity_resource
|> UserIdentity.Info.user_identity_user_id_attribute_name(),
UserIdentity.Info.user_identity_user_id_attribute_name(strategy.identity_resource),
{:ok, _identity} <-
strategy.identity_resource
|> UserIdentity.Actions.upsert(%{
UserIdentity.Actions.upsert(strategy.identity_resource, %{
user_info: Changeset.get_argument(changeset, :user_info),
oauth_tokens: Changeset.get_argument(changeset, :oauth_tokens),
strategy: Strategy.name(strategy),
Expand All @@ -44,7 +42,6 @@ defmodule AshAuthentication.Strategy.OAuth2.IdentityChange do
user
|> Ash.load(strategy.identity_relationship_name, domain: Info.domain!(strategy.resource))
else
:error -> :error
{:error, reason} -> {:error, reason}
end
end)
Expand Down
4 changes: 0 additions & 4 deletions lib/ash_authentication/strategies/oauth2/transformer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ defmodule AshAuthentication.Strategy.OAuth2.Transformer do
:ok <- maybe_validate_action_has_identity_change(action, strategy) do
:ok
else
:error ->
{:error, "Unable to validate register action"}

{:error, reason} when is_binary(reason) ->
{:error, "`#{inspect(strategy.register_action_name)}` action: #{reason}"}

Expand Down Expand Up @@ -139,7 +136,6 @@ defmodule AshAuthentication.Strategy.OAuth2.Transformer do
:ok <- validate_action_has_preparation(action, OAuth2.SignInPreparation) do
:ok
else
:error -> {:error, "Unable to validate sign in action"}
{:error, reason} -> {:error, reason}
end
end
Expand Down
3 changes: 0 additions & 3 deletions lib/ash_authentication/verifier.ex
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ defmodule AshAuthentication.Verifier do
{:ok, falsy} when is_falsy(falsy) ->
:ok

{:error, reason} ->
{:error, reason}

{false, bad_token_resource} ->
{:error,
DslError.exception(
Expand Down

0 comments on commit 02f8a85

Please sign in to comment.