Skip to content

Ash Authentication exception when signing in using magic link to unconfirmed account #134

@stryderjzw

Description

@stryderjzw

Describe the bug
Installed both password and magic link authentication.
Signing in with magic link to an account that is unconfirmed raises the exception at the end of the ticket.
This is with the default prevent_highjacking? true on confirmation addon. Turning highjacking off does not raise an exception.

To Reproduce
I have default defined resources when installed by Igniter.

  1. Create an account using password
  2. Do not confirm the account
  3. Sign in using magic link using that same account
  4. Exception raised

Expected behavior
No exception raised

** Runtime
ash 3.4.64
ash_authentication 4.5.1
ash_sqlite 0.2.3

Additional context

Bread Crumbs: > Exception raised in: Playground.Accounts.User.sign_in_with_magic_link Unknown Error * ** (CaseClauseError) no case clause matching: {:ok, []} (ash_sqlite 0.2.3) lib/data_layer.ex:1213: AshSqlite.DataLayer.upsert/3 (ash 3.4.64) lib/ash/actions/create/create.ex:377: anonymous fn/6 in Ash.Actions.Create.commit/3 (ash 3.4.64) lib/ash/changeset/changeset.ex:4021: Ash.Changeset.run_around_actions/2 (ash 3.4.64) lib/ash/changeset/changeset.ex:3699: anonymous fn/2 in Ash.Changeset.transaction_hooks/2 (ash 3.4.64) lib/ash/changeset/changeset.ex:3609: Ash.Changeset.with_hooks/3 (ash 3.4.64) lib/ash/actions/create/create.ex:260: Ash.Actions.Create.commit/3 (ash 3.4.64) lib/ash/actions/create/create.ex:132: Ash.Actions.Create.do_run/4 (ash 3.4.64) lib/ash/actions/create/create.ex:50: Ash.Actions.Create.run/4 (ash_authentication 4.5.1) lib/ash_authentication/strategies/magic_link/actions.ex:62: AshAuthentication.Strategy.MagicLink.Actions.sign_in/3 (ash_authentication 4.5.1) lib/ash_authentication/strategies/magic_link/plug.ex:44: AshAuthentication.Strategy.MagicLink.Plug.sign_in/2 (ash_authentication 4.5.1) lib/ash_authentication/plug/dispatcher.ex:29: AshAuthentication.Plug.Dispatcher.call/2 (phoenix 1.7.18) lib/phoenix/router/route.ex:42: Phoenix.Router.Route.call/2 (phoenix 1.7.18) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5 (playground 0.1.0) lib/playground_web/endpoint.ex:1: PlaygroundWeb.Endpoint.plug_builder_call/2 (playground 0.1.0) deps/plug/lib/plug/debugger.ex:136: PlaygroundWeb.Endpoint."call (overridable 3)"/2 (playground 0.1.0) lib/playground_web/endpoint.ex:1: PlaygroundWeb.Endpoint.call/2 (phoenix 1.7.18) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4 (bandit 1.6.6) lib/bandit/pipeline.ex:129: Bandit.Pipeline.call_plug!/2 (bandit 1.6.6) lib/bandit/pipeline.ex:40: Bandit.Pipeline.run/4 (bandit 1.6.6) lib/bandit/http1/handler.ex:12: Bandit.HTTP1.Handler.handle_data/3 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions