nheingit
Hey everyone. I was trying to add multi tenancy (attribute-based) to my existing application that’s running ash_authentication.
To do this I needed to tie users to a new organizations resource upon account creation.
I wanted to hook into the existing register_with_password action since that’s already being used by some of my tests + the generated UI, but I wasn’t having much success in finding a way into the lifecycle of that action.
I tried overwriting the action in my resource by creating my own register_with_password field. But I quit getting errors upon compiling when I had just this bit of code:
create :register_with_password do
argument :password, :string, allow_nil?: false, sensitive?: true
argument :password_confirmation, :string, allow_nil?: false, sensitive?: true
change AshAuthentication.GenerateTokenChange
change AshAuthentication.Strategy.Password.HashPasswordChange
validate AshAuthentication.Strategy.Password.PasswordConfirmationValidation
end
From here looking at the HashPasswordChange documentation it looks like it should handle the hashing of the password, but if I try to use this new action, I get an error telling me that I’m missing the :hashed_password field in my changeset.
Was curious if anyone else had tried to do this and could point me in the right direction, or maybe I’m approaching the problem from the wrong angle?
Trending in Questions
Other Trending Topics
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
Try adding
accept [:email]nheingit
Sorry, worth mentioning I’m still on 2.21, not on 3.0 yet. So accept should have
emailcovered by default correct? Regardless I tried and didn’t see any difference there.This is the whole resource for posterities sake. I don’t think I’ve changed anything from the tutorial other than the multi-tenancy bit. The other attempt I made at implementing the internals with the
:sign_in_with_passwordworks no problem for what it’s worth.zachdaniel
Try adding
allow_nil_input [:hashed_password]? I believe in 3.0 that should not be necessary, but perhaps it is in 2.0, I don’t recall for surenheingit
That did the trick! thank you so much