sentinel
sentinel copied to clipboard
Custom redirect paths
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}
}
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.
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?
I am also interested in seeing custom redirects.
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"
}
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.
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.
This is currently available for careful testing in the features/lockable_and_plug
branch.