AE
Ash Elixirβ€’3y ago
axdc

AshAuthentication redirecting on errors

I'm using AshAuthentication with the email and password strategy. When I enter incorrect info, whether that's a wrong password or for a nonexistent user, I get redirected to another page with the error. Is this intentional design or have I configured something incorrectly? I was expecting to get errors in the (to me) "normal" form validation red text sort of way. Didn't see anything about this in the documentation, just curious if anyone else has experienced this. Thanks so much :thinkies: πŸ™‡
4 Replies
jart
jartβ€’3y ago
Hi @axdc yeah, currently the validation is done on the live view before submit. and the actual password submission is done over HTTP. This means you need to define the failure/handle_failure callback of your controller/plug to do what you expect.
ZachDaniel
ZachDanielβ€’3y ago
What people are currently doing to show the error is render a flash message in their layout view We’re going to add a helper that lets you set an error message in your auth controller and shows it in the form as if it were a normal form error Hey @axdc just FYI: we've got PRs in to make this all work the way you expect. May take some time to get them cleaned up/reviewed, but soon ideally within the next few days there will be a toggle you can turn on that makes the liveview show errors more idiomatically, and prevents the need for flash messages and the like. A lot of other people will probably be glad to hear it too
vedha.ivan
vedha.ivanβ€’3y ago
glad to hear it !
axdc
axdcOPβ€’3y ago

Did you find this page helpful?