trestle-auth 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc7d72e5d295f88b10eeb2a14c1a854ba9f7cfb59617a4ec9dd4cea95d00295a
4
- data.tar.gz: b4e1dfdcba7438acf673c6f36dc2cf4c81eba3c28dcd92d99403bee8f844c803
3
+ metadata.gz: f832127b8855a20f54f8864a8e85389953e7fa1c3ac62c6fe04f18b545ecbeeb
4
+ data.tar.gz: 824a202d4c14c5a6de29106d95873cb0a168dc98c13e69641b129d1be96d11e5
5
5
  SHA512:
6
- metadata.gz: b2b1b76740eac08413c4e074cc2e8a530b8d428905d6fc9a48b2de814457a3cf1d1716698a14306466e93fa29afedf358258a320177cb2ac1e71e7c5b6ee24b7
7
- data.tar.gz: 246cef636500c0e8337a1a0bf447923d251ee34c48a5de108becfd07b2320f8732e6b08610a0e7c1bf1e852f21d3d5818ac2eda71b4d7b71a9cb0071374be785
6
+ metadata.gz: 84760577a9abb2bddc4fa050b611b00236d698433b1c85f8dad72c4eab783c0315099d058fc2219cad2806d450b3d976c3a0675cda26913e13f91c50758be446
7
+ data.tar.gz: d22504002dc580c1a8fcfac296dff35299510d063eb10e59dab2d3e0b76b624e93650162ae8032c6f1170ee583aa6bbf7d3b90fc73a03ae1d5ae92e00bda8c6e
@@ -52,12 +52,20 @@ module Trestle
52
52
  path = File.expand_path(find_in_source_paths(path.to_s))
53
53
  context = options.delete(:context) || instance_eval("binding")
54
54
 
55
- capturable_erb = CapturableERB.new(::File.binread(path), trim_mode: "-", eoutvar: "@output_buffer")
56
-
57
- content = capturable_erb.tap do |erb|
55
+ content = capturable_erb(path).tap do |erb|
58
56
  erb.filename = path
59
57
  end.result(context)
60
58
  end
59
+
60
+ def capturable_erb(path)
61
+ match = ERB.version.match(/(\d+\.\d+\.\d+)/)
62
+
63
+ if match && match[1] >= "2.2.0" # Ruby 2.6+
64
+ CapturableERB.new(::File.binread(path), trim_mode: "-", eoutvar: "@output_buffer")
65
+ else
66
+ CapturableERB.new(::File.binread(path), nil, "-", "@output_buffer")
67
+ end
68
+ end
61
69
  end
62
70
  end
63
71
  end
@@ -9,6 +9,9 @@ module Trestle
9
9
 
10
10
  prepend_before_action :require_authenticated_user
11
11
  prepend_before_action :authenticate_user
12
+
13
+ # Ensure that CSRF protection happens before authentication
14
+ protect_from_forgery prepend: true
12
15
  end
13
16
 
14
17
  protected
@@ -1,5 +1,5 @@
1
1
  module Trestle
2
2
  module Auth
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trestle-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Pohlenz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-27 00:00:00.000000000 Z
11
+ date: 2021-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trestle