fix: ensure tenant is set when revoking tokens and on changeset for updating

This commit is contained in:
Zach Daniel 2024-05-29 09:05:44 -04:00
parent 43642c305e
commit e1cdc10b89

View file

@ -235,13 +235,13 @@ defmodule AshAuthentication.Strategy.Password.Actions do
ash_authentication?: true
}
})
|> Changeset.for_update(resettable.password_reset_action_name, params)
|> Changeset.for_update(resettable.password_reset_action_name, params, options)
|> Changeset.after_action(fn _changeset, record ->
token_resource = Info.authentication_tokens_token_resource!(resource)
:ok = TokenResource.revoke(token_resource, token)
:ok = TokenResource.revoke(token_resource, token, options)
{:ok, record}
end)
|> Ash.update(options)
|> Ash.update()
else
{:error, %Changeset{} = changeset} -> {:error, changeset}
_ -> {:error, Errors.InvalidToken.exception(type: :reset)}