chore: Fix dialyzer failures.

This commit is contained in:
James Harton 2024-08-19 09:46:45 +12:00
parent 01d3fde5c0
commit 02f8a8541b
Signed by: james
GPG key ID: 90E82DAA13F624F4
4 changed files with 4 additions and 25 deletions

View file

@ -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

View file

@ -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),
@ -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)

View file

@ -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}"}
@ -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

View file

@ -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(