Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension routes #141

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danschultzer
Copy link
Collaborator

@danschultzer danschultzer commented Mar 15, 2019

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 danschultzer force-pushed the refactor-extension-messages-routes branch from 675c852 to 3f7a33c Compare March 15, 2019 17:30
@danschultzer danschultzer changed the title Refactor extension messages routes Refactor extension messages and routes Mar 15, 2019
@danschultzer danschultzer force-pushed the refactor-extension-messages-routes branch from 3f7a33c to e047376 Compare March 15, 2019 17:32
@danschultzer danschultzer force-pushed the refactor-extension-messages-routes branch 2 times, most recently from 86cec5a to 5d28fa3 Compare March 16, 2019 01:01
@danschultzer danschultzer force-pushed the refactor-extension-messages-routes branch from 5d28fa3 to 3c76511 Compare March 16, 2019 02:47
@danschultzer danschultzer changed the title Refactor extension messages and routes Add extension routes Mar 16, 2019
@danschultzer danschultzer force-pushed the refactor-extension-messages-routes branch from 3c76511 to 2c0fe97 Compare May 30, 2019 14:37
Also added overridable routes for email confirmation
@danschultzer danschultzer force-pushed the refactor-extension-messages-routes branch from 2c0fe97 to 8f49c74 Compare May 30, 2019 15:40
@albertoramires
Copy link

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

@danschultzer
Copy link
Collaborator Author

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.

@albertoramires
Copy link

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

@danschultzer
Copy link
Collaborator Author

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

@joepstender
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants