smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 224 forks source link

Assign any callback after user create. #332

Closed Merff closed 6 years ago

Merff commented 6 years ago

Hi, thx for good lib. What is the best way to assign any callback on after create user? I try to change MyApp.Coherence.Schemas functions: create_user(params), but it doesn't work. Tnx!

smpallen99 commented 6 years ago

In order to use MyApp.Coherence.Schemas you need to generate controllers for ur project with mix coh.gen.controllers. Once they are generated and you have updated ur router, that module should be used. You also then have the option of modifying the controllers themselves if you can't get enough functionality from the Schemas module.

Another option is to add a prepare hook in your user schema module. The downside of this approach is that you won't have the id of the user model.