Defect #26518

Rails 5: Adding a block in My Page causes "Invalid form authenticity token."

Added by Go MAEDA 12 months ago. Updated 12 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:My page
Target version:-
Resolution:Fixed Affected version:

Description

Steps to reproduce:

1. Open "My Page".
2. Add an any block. You will see "Invalid form authenticity token."

development.log:

There is an error "Can't verify CSRF token authenticity".

Started POST "/my/add_block" for 127.0.0.1 at 2017-07-25 11:00:28 +0900
Processing by MyController#add_block as HTML
  Parameters: {"utf8"=>"✓", "block"=>"issuequery"}
Can't verify CSRF token authenticity.
  AnonymousUser Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."type" IN ('AnonymousUser') ORDER BY "users"."id" ASC LIMIT ?  [["LIMIT", 1]]
  Rendering common/error.html.erb within layouts/base
  Rendered common/error.html.erb within layouts/base (1.5ms)
Filter chain halted as :verify_authenticity_token rendered or redirected
Completed 422 Unprocessable Entity in 28ms (Views: 24.5ms | ActiveRecord: 0.3ms)

diff.patch Magnifier (487 Bytes) Mizuki ISHIKAWA, 2017-07-25 04:39


Related issues

Related to Redmine - Feature #23630: Migrate to Rails 5.2 Closed

Associated revisions

Revision 16884
Added by Jean-Philippe Lang 12 months ago

Use jquery-rails instead of vanilla javascript ujs (#26518).

History

#1 Updated by Go MAEDA 12 months ago

  • Target version set to 4.0.0

#2 Updated by Go MAEDA 12 months ago

  • Subject changed from Rails 5: Adding a block in My Page cases "Invalid form authenticity token." to Rails 5: Adding a block in My Page causes "Invalid form authenticity token."

#3 Updated by Mizuki ISHIKAWA 12 months ago

A quick workaround.

#4 Updated by Jean-Philippe Lang 12 months ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version deleted (4.0.0)
  • Resolution set to Fixed

This is fixed by r16884. We now use jquery-ujs instead of the vanilla javascript ujs provided with rails 5.

#5 Updated by Jean-Philippe Lang 12 months ago

Also available in: Atom PDF