Skip to content

Commit 0b3e831

Browse files
authored
Remove form_authenticity_token method (#371)
* Remove form_authenticity_token method Fix #330 As detailed in the URL below, the call to `form_authenticity_token` wasn't useful and was causing issues like #330, so remove it. ref: - #357 (comment) - #357 (comment) * Update CHANGELOG with removal of form_authenticity_token method
1 parent 0f937d9 commit 0b3e831

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22
## HEAD
3+
4+
* Remove form_authenticity_token method [#371](https://github.com/Sorcery/sorcery/pull/371)
35
* Remove legacy Rails version conditionals [#370](https://github.com/Sorcery/sorcery/pull/370)
46
* Bump up required ruby version to 3.0.0 [#369](https://github.com/Sorcery/sorcery/pull/369)
57

lib/sorcery/controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def login(*credentials)
5454
old_session.each_pair do |k, v|
5555
session[k.to_sym] = v
5656
end
57-
form_authenticity_token
5857

5958
auto_login(user, credentials[2])
6059
after_login!(user, credentials)

spec/controllers/controller_spec.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@
6363
it 'writes user id in session' do
6464
expect(session[:user_id]).to eq user.id.to_s
6565
end
66-
67-
# NOTE: The lack of a CSRF token may mean that sessions will break
68-
# horribly for Sorcery when using Rails 7.1+. We shall see.
69-
it 'sets csrf token in session' do
70-
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
71-
pending 'Rails 7.1 is not including the csrf token in the session for unknown reasons'
72-
end
73-
74-
expect(session[:_csrf_token]).not_to be_nil
75-
end
7666
end
7767

7868
context 'when fails' do

0 commit comments

Comments
 (0)