Project

General

Profile

Actions

Defect #26518

closed

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

Added by Go MAEDA about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Category:
My page
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
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)

Files

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

Related issues

Related to Redmine - Feature #23630: Migrate to Rails 5.2ClosedJean-Philippe Lang

Actions
Related to Redmine - Patch #31205: Replace jquery-rails with vanilla javascript ujsClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA about 6 years ago

  • Target version set to 4.0.0
Actions #2

Updated by Go MAEDA about 6 years 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."
Actions #3

Updated by Mizuki ISHIKAWA about 6 years ago

A quick workaround.

Actions #4

Updated by Jean-Philippe Lang about 6 years 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.

Actions #5

Updated by Jean-Philippe Lang about 6 years ago

Actions #6

Updated by Marius BALTEANU over 4 years ago

  • Related to Patch #31205: Replace jquery-rails with vanilla javascript ujs added
Actions

Also available in: Atom PDF