Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix password sign-in bug caused by Rails 5 upgrade
Previously, if you tried to sign in with a password, the request would succeed but you wouldn't get an authenticated session. The fix is to ensure `protect_from_forgery` is called as early as possible, because otherwise if anything devisey (like `authenticate_user` or even just `current_user`) calls `warden.authenticate` first, the CSRF token validation will fail, invalidating your session. In Rails 4.2, regardless of where `protect_from_forgery` was called, it would cause `verify_authenticity_token` to run before all other `before_action`s. Moving #protect_with_forgery to the beginning of ApplicationController restores the Rails 4.2 behavior and ensures the CSRF token validates. Fixes railsbridge#530
- Loading branch information