Edit error messages for Identity
Problem
I have a User resource with an email identity constraint:
When a user tries to update their email to one that already exists, Ash returns "has already been taken" which creates a username enumeration security vulnerability, since I'm using an ash form I can figure out how to override this error to show something else, e.g.: "Your change cannot be made at this time, please contact support."
What I've Tried
I attempted to use
after_action
to catch and transform the error but seems kind of ugly and I'm convinced there is a more elegant solution
Any guidance on the proper Ash pattern for this would be greatly appreciated!2 Replies
you can use the
message
option to the identity https://hexdocs.pm/ash/dsl-ash-resource.html#identities-identitythank you
!!