Skip to content

Commit

Permalink
Add fix for weird csrf problems in updated version of rails
Browse files Browse the repository at this point in the history
  • Loading branch information
dlinch committed May 3, 2021
1 parent ba01dd2 commit 28ad383
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/helpers/adminsimple/modules/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Adminsimple::Modules::ApplicationHelper
def rescued_csrf_meta_tags
csrf_meta_tags
rescue ArgumentError
request.reset_session
csrf_meta_tags
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/adminsimple/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%meta{ charset: "UTF-8" }
%meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
= render partial: "/adminsimple/layout/head"
= csrf_meta_tags
= rescued_csrf_meta_tags
:javascript
if(typeof Storage !== undefined && localStorage.theme) {document.querySelector('html').setAttribute('id', "adminsimple_" + localStorage.theme);}
= stylesheet_link_tag 'adminsimple'
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/adminsimple/devise.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%title= t('adminsimple.site_name')
%meta{ charset: "UTF-8" }
%meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
= csrf_meta_tags
= rescued_csrf_meta_tags
:javascript
if(typeof Storage !== undefined && localStorage.theme) {document.querySelector('html').setAttribute('id', "adminsimple_" + localStorage.theme);}
= stylesheet_link_tag 'adminsimple'
Expand Down
2 changes: 1 addition & 1 deletion lib/adminsimple/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Adminsimple
VERSION = '0.0.3'
VERSION = '0.0.4'
end

0 comments on commit 28ad383

Please sign in to comment.