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: https://hexdocs.pm/pow/Pow.Phoenix.Router.html#pow_routes/0

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

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
nobody
Hi! In PHP: $SERVER['SERVERADDR'] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I'm a nov...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

Other popular topics Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
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
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I'm a nov...
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

We're in Beta

About us Mission Statement