Elixir Blog Posts

Very nice description of how you can extends phx.gen.auth to do magic links (without any extra dependencies). Thanks for sharing!

The only minor feedback I’d have is to avoid calling back to your web module from your context module here. This creates a cyclical dependency. The original functions that send emails (like this one), in the Accounts context module avoid this by accepting an extra function that generates a full url, given an encoded token. Extending this pattern would be a better choice IMO.

1 Like