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

Change of user_root path helper changes devise redirect behaviour #155

Open
phantomwhale opened this issue Dec 8, 2022 · 0 comments
Open

Comments

@phantomwhale
Copy link

This may or may not be an "issue" with Alchemy-devise; excuse my limited knowledge of devise here.

But for our application, which we're slowly upgrading to latest alchemy gems, we hit upon a surprise in Alchemy 4.5

We are using SAML, and the devise_saml_authenticatable gem, which means we end up defining our own routes to the saml controller this provides, but use the devise_for :users statement in our routes files.

After the upgrade to 4.5, we found users being logged in were getting returned to the root_path (/) rather than the alchemy dashboard.

After some digging, it was found the reason for this was in the method https://github.com/heartcombo/devise/blob/main/lib/devise/controllers/helpers.rb#L169-L186

This method uses the scope (user) to construct a path name (user_root_path) which used to be defined in Alchemy-devise 4.4

But after the upgrade to Alchemy 4.5, this gets moves into the admin namespace, which means it gets renamed to admin_user_root_path - and so devise can't find user_root_path and falls back to root_path

Our workaround is to use a different devise scope name (:saml_user) and define saml_user_root_path ourselves, which perhaps is more of an indication we aren't using this gem for it's full purpose and a reflection of our usage. But equally, given the issue came from devise (not explictly the SAML gem) I was surprised this renaming of the user path helpers didn't affect other users of this gem, so wanted to raise it?

As I say, more likely my lack of familiarity with these gems than a real issue, but would appreciate any feedback, and thought it still worth raising in case the change of route naming wasn't deliberate (although given the age of v4.5+, I think it's very likely to not be an issue!)

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

1 participant