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

Custom redirect paths #42

Open
trestrantham opened this issue Apr 2, 2017 · 7 comments
Open

Custom redirect paths #42

trestrantham opened this issue Apr 2, 2017 · 7 comments

Comments

@trestrantham
Copy link
Contributor

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}
  }
@britton-jb
Copy link
Owner

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.

@trestrantham
Copy link
Contributor Author

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?

@sgeos
Copy link

sgeos commented May 23, 2017

I am also interested in seeing custom redirects.

@sgeos
Copy link

sgeos commented May 24, 2017

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"
  }

@britton-jb
Copy link
Owner

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
Copy link
Owner

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
Copy link
Owner

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

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

No branches or pull requests

3 participants