pow
pow copied to clipboard
Add extension routes
This allows for custom extension routes. Custom route for email confirmation will look like this:
defmodule MyAppWeb.Pow.Routes do
use Pow.Phoenix.Routes
use Pow.Extension.Phoenix.Routes,
extension: [PowEmailConfirmation]
alias MyAppWeb.Router.Helpers, as: Routes
def pow_email_confirmation_after_halted_registration_path(conn), do: Routes.some_path(conn, :index)
end
I'm thinking that either extension Messages and Routes should be optional, or required on compile time. Right now it'll only fail in runtime, which makes it difficult to know beforehand if something is missing.
Hey @danschultzer, sorry to bother you with this but do you intend to pick this up in the near future? Thanks. 🙇
Let me see if next week I can go through this again. Last I worked with it I felt this was too fickle, and not very explicit, so I didn't merge it in right away. I'll have to go through the code base again to see exactly what it was that bothered me.
What's your use case? It may help me think this PR through.
Sorry for the delay @danschultzer. I actually ended up solving the issue without needing to use the extension routes, I was having issues getting my path_for
to be used in one of the extensions so I thought this issue was to blame but then I noticed that session_path
and registration_path
actually have their own def so I just made those use my custom path_for
, thank you so much for such a swift response though. 🙇
No problem, great to hear that you could fix the issue with the current Pow release! This PR might not be necessary at all.
It would be great to have this, not having to create custom controllers for every custom extension route would be a big win!