sentinel icon indicating copy to clipboard operation
sentinel copied to clipboard

Custom redirect paths

Open trestrantham opened this issue 7 years ago • 7 comments

Has there been any thought on accommodating custom redirect paths? I really like how coherence handles these (https://github.com/smpallen99/coherence#customizing-redirections) but they could just as easily be added as a configuration with something like this, too:

config :sentinel,
  redirects: %{
    auth_callback: {:controller, :action},
    password_create: {:controller, :action}
  }

trestrantham avatar Apr 02 '17 20:04 trestrantham

I hadn't thought about customizing redirects at this point, but would be open to it. Just not a use case I've personally had yet.

britton-jb avatar Apr 03 '17 15:04 britton-jb

Ok cool. 😎 I can whip up another PR tonight to abstract redirection logic into a RedirectHelper. Any preference on exposing this to the user/dev as a module or configuration option?

trestrantham avatar Apr 03 '17 15:04 trestrantham

I am also interested in seeing custom redirects.

sgeos avatar May 23 '17 06:05 sgeos

So far as I can tell, custom redirect configuration is actually in the latest GitHub code. This functionality does not appear to be documented, nor does it appear to be in the standard (non-GitHub) version 2.0.1.

The following snippets can be used to change the post login redirect. The list of redirect keys can be found by calling Sentinel.Config.redirects() from iex -S mix.

mix.exs

  defp deps do
    [
      {:sentinel, git: "https://github.com/britton-jb/sentinel.git"}
    ]
  end

config/config.exs

config :sentinel,
  redirects: %{
    session_create: "/some/other/page"
  }

sgeos avatar May 24 '17 03:05 sgeos

Currently master and the latest hex release have diverged, I'm working on a few more changes before the next release because the next hex release will contain breaking changes, and I want to get all of the breaking changes that are on the immediate horizon out of the way. Sorry about the confusion. I'll make sure to be more clear about that in the future, and update the README to reflect that.

britton-jb avatar May 24 '17 16:05 britton-jb

A PR with this code has been merged, I'm just working on wrapping up the lockable code for v3 before we increment the hex version, because it will include other small breaking API changes.

britton-jb avatar May 25 '17 13:05 britton-jb

This is currently available for careful testing in the features/lockable_and_plug branch.

britton-jb avatar Oct 04 '17 14:10 britton-jb