Assumption failed: Action does not correlate with an authentication strategy
Follow up question related to https://github.com/ash-project/ash/issues/516
The same error persists after adding
change set_context(%{strategy_name: :password})
GitHub
This error was unhandled because it did not implement the `AshPhoen...
Describe the bug The following error when running validation of a password change form. iex(1)> [debug] HANDLE EVENT View: MyAppWeb.UserLive.UserSettings Event: "validate_password&a...
33 Replies
🤔 I summon the great and powerful @jart (when he has time)
Quick Q: is your password strategy named
:password
? It will be if it's just password do
Does this answer your question?
yes
Do both of those changes know to check the context?
or, the validation and changes?
please hold
I'd be pretty surprised if they don't - they're used all over the place
found the problem.
I will be away for a while. sorry
PasswordValidationConfirmation
only looks in the changeset context because the other context isn't passed in to validations
I think we should make it take strategy_name
as an option tooNot sure I follow
the
set_context
builtin sets the "action context" but validations don't see thatThe context is in changeset.context
Which is a very confusing thing I see now
But they aren’t the same thing
are you sure?
Hm…
Pretty sure?
@jasono can you try using the
improvement/pass-strategy-name-as-option-to-password-confirmation-validation
branch for me? And changing validate AshAuthentication.Strategy.Password.PasswordConfirmationValidation
to validate AshAuthentication.Strategy.Password.PasswordConfirmationValidation, strategy_name: :password
please?Sure. Thanks
Wait is @Jason and @jasono the same person?
Both are mine but I didn't know two IDs can be used in one server.
@jart Is this branch for ash_authentication_phoenix that I should try?
no, ash_authentication
got it.
@jart I may be doing something wrong, but I get this now.
user.ex:8 is this
admin do
actor? true
end
but if I comment these out, a similar error then happens on the next line which is
I think you need to upgrade
ash
and ash_postgres
to use that latest versionOkay. that's kind of what I was suspecting. hold on
hmm... no luck. Still the same "Assumption failed: Action does not correlate with an authentication strategy" error.
did you change the validate line?
oops.. one sec.
it should be
{Module, strategy_name: :password}
doh
You mean like this?
validate {AshAuthentication.Strategy.Password.PasswordConfirmationValidation,
strategy_name: :password}
yep!
Since its an option specific to that validation
hmm...do you have an
update_user_password
and a change_user_password
action?
or did you change the name of the action?I didn't realize I had both. Let me remove one 😦
It's working!!! Thank you both very much!!
Enjoy!
I'll do a release of ash_authentication with that fix.