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

Ignore non-String shop params in login_again_if_different_shop #477

Merged
merged 2 commits into from
Sep 28, 2017

Conversation

Hammadk
Copy link
Member

@Hammadk Hammadk commented Sep 27, 2017

Reverts #430, and adds a test to prevent regression.

In #430, I removed the params[:shop].is_a?(String) check from LoginProtection:: login_again_if_different_shop because we didn't think it was needed.

While working on another project I found out that this check is needed. Consider the case where someone has a Shop model in Rails. When they use form_for in a controller, Rails passes along the params under the shop hash, so:

shop : {
  id: 123,
  foo: bar
}

If this hash is passed to login_again_if_different_shop, the following check is always true: shop_session.url != params[:shop]. Of course, using the non-default param gets around this.

@Hammadk Hammadk changed the title Expect params[:shop] to be a string Ignore non-String shop params in login_again_if_different_shop Sep 27, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants