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

scope_url in FailureApp doesn't account for host #5596

Open
philipithomas opened this issue May 7, 2023 · 0 comments
Open

scope_url in FailureApp doesn't account for host #5596

philipithomas opened this issue May 7, 2023 · 0 comments

Comments

@philipithomas
Copy link

Environment

  • Ruby 3.2.2
  • Rails 7.0.4
  • Devise 4.9

Current behavior

I'm using devise on multiple domains, similar to the subdomain setup described in the docs, with confirmable and recoverable

Here's the issue I'm hitting:

  1. User signs up
  2. User tries to sign in with unconfirmed email
  3. App responds with redirect to root url default host, away from the current subdomain I'm on

Expected behavior

User should stay on the subdomain upon this error.

Technical details

Most session errors return a 422. But, this failure hits the FailureApp#scope_url method.

The issue is that the scope_url is not host-aware, but returns a url instead of a path. Therefore, the user may get redirected to a different host.

I believe the best way to fix this is to add opts[:host] = request.host to the scope_url function. I'm doing this with a custom failure app right now, and think it makes sense to incorporate into the main code base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant