ashok

ashok

Overwrite Pow Route

I want to overwrite the Pow route from

pow_registration_path POST /registration Pow.Phoenix.RegistrationController :create

to

pow_registration_path POST / Pow.Phoenix.RegistrationController :create

So that if visit my website home page it will show registration form which currently visible when I visite URL like example.com/registration/new I have done modification in router.ex as shown below

get “/”, Pow.Phoenix.RegistrationController, :new

and now when I visite my website home page lets say example.com it shows me Pow registration page. If I hit submit without inserting any data in the form field it redirects me the /registration which is the default behavior of Pow my requirement is to redirect to the home page again instead of /register.

I am assuming that it should be done if I will modify my router.ex and overwrite my Pow router there, as shown in the URL: Pow.Phoenix.Router — Pow v1.0.39

but not sure what to pass in it

pow_route(verb, path, plug, plug_opts, options \ )

I do not have idea on params passed like ‘verb’,‘path’,‘plug’,‘plug_opts’,‘options \’ what to pass in them

please suggest how to achieve it. Am I thinking in the correct way? or there will be another way of achieving it.?

Marked As Solved

ashok

ashok

[SOLVED] When I modified the issue in webpack-loader

Also Liked

danschultzer

danschultzer

Pow Core Team

You can handle it with a custom callback routes module:

defmodule MyAppWeb.Pow.Routes do
  use Pow.Phoenix.Routes
  alias MyAppWeb.Router.Helpers, as: Routes

  def after_sign_in_path(conn), do: Routes.some_path(conn, :index)
end

Add routes_backend: MyAppWeb.Pow.Routes to your configuration.

Kurisu

Kurisu

I think you just need to set as well a path in your router for the create action.

Here is how I did it:

# Registration route
  scope "/compte/inscription", Pow.Phoenix, as: "pow" do
    pipe_through :browser
    get "/", RegistrationController, :new
    post "/", RegistrationController, :create
  end

Just replace “/compte/inscription” by whatever you want to show up as registration url in the browser. That would be “/” in your case.

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31525 112
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement