@danschultzer, I went with custom controller which helps me to return a valid error message to the user. And i have set the action variable, which worked fine on generated templates.
def create(conn, %{"user" => user_params}) do
# We'll leverage [`Pow.Plug`](Pow.Plug.html), but you can also follow the classic Phoenix way:
# user =
# %MyApp.Users.User{}
# |> MyApp.Users.User.changeset(user_params)
# |> MyApp.Repo.insert()
case MyApp.Users.create_user_using_referral(user_params) do
{:ok, user} ->
conn
|> put_flash(:info, "Welcome, Lets find your spouse!")
|> redirect(to: Routes.dashboard_path(conn, :index))
{:invalid_code, changeset} ->
conn
|> put_flash(:error, "You have entered an invalid code")
|> render("new.html", changeset: changeset, action: Routes.registration_path(conn, :create))
{:error, changeset} ->
conn
|> put_flash(:error, "Please correct the errors")
|> render("new.html", changeset: changeset, action: Routes.registration_path(conn, :create))
end
end


















