pow icon indicating copy to clipboard operation
pow copied to clipboard

Add extension routes

Open danschultzer opened this issue 5 years ago • 5 comments

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.

danschultzer avatar Mar 15 '19 17:03 danschultzer

Hey @danschultzer, sorry to bother you with this but do you intend to pick this up in the near future? Thanks. 🙇

albertoramires avatar Jul 21 '19 16:07 albertoramires

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.

danschultzer avatar Jul 21 '19 18:07 danschultzer

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. 🙇

albertoramires avatar Jul 23 '19 01:07 albertoramires

No problem, great to hear that you could fix the issue with the current Pow release! This PR might not be necessary at all.

danschultzer avatar Jul 23 '19 05:07 danschultzer

It would be great to have this, not having to create custom controllers for every custom extension route would be a big win!

joepstender avatar Jan 09 '20 22:01 joepstender