Commit 9b7b27ce7216652493648228f2352d1d08836549

Authored by Dmitriy Zaporozhets
1 parent c959143e

Add authenticity_token: true to multipart forms

Rails 4 does not generate token by default
It fixes bug when you get to sign-in page after trying to upload image
with comment

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/views/profiles/show.html.haml
... ... @@ -8,7 +8,7 @@
8 8  
9 9  
10 10  
11   -= form_for @user, url: profile_path, method: :put, html: { multipart: true, class: "edit_user form-horizontal" } do |f|
  11 += form_for @user, url: profile_path, method: :put, html: { multipart: true, class: "edit_user form-horizontal" }, authenticity_token: true do |f|
12 12 -if @user.errors.any?
13 13 %div.alert.alert-error
14 14 %ul
... ...
app/views/projects/notes/_form.html.haml
1   -= form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note js-new-note-form common-note-form" } do |f|
  1 += form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note js-new-note-form common-note-form" }, authenticity_token: true do |f|
2 2  
3 3 = note_target_fields
4 4 = f.hidden_field :commit_id
... ...
app/views/projects/walls/show.html.haml
... ... @@ -3,7 +3,7 @@
3 3  
4 4 - if can? current_user, :write_note, @project
5 5 .note-form-holder
6   - = form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note wall-note-form" } do |f|
  6 + = form_for [@project, @note], remote: true, html: { multipart: true, id: nil, class: "new_note wall-note-form" }, authenticity_token: true do |f|
7 7 = note_target_fields
8 8 .note_text_and_preview
9 9 = f.text_area :note, size: 255, class: 'note_text js-note-text js-gfm-input turn-on'
... ...