trestle-auth-otp 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95cb244f303570eefb067e81a3635c1163b3b936ffd61814efa67e97284395e4
4
- data.tar.gz: da9db1ad06e17624ce6dce2f27828f2df80beb1598715665f93602af9d13b4c2
3
+ metadata.gz: 374cc9fd85767e3b8e4137bad18c289e815c290eb5f471eb9158f14152a37fd2
4
+ data.tar.gz: bfa8672bcad7a75447cf23a79f9fb932f57ed216129296e9bf55626bc9acbe9b
5
5
  SHA512:
6
- metadata.gz: dfb1d34e02658de3b3762ecb77aca0d14536c968dfd4dfed7656c87b8cb310366512194cfbd4e23b71b2fa729d6922782c688488101478bad3b27dda3ed6c32c
7
- data.tar.gz: 372bc30f44390299e2321b74b72dc15646e97023ffe8f7a3180ba2863403b5013893694cb4a9d1d2acbd9170187b6f2d6d10c8c8e764bea2072dfe5dcfa7eece
6
+ metadata.gz: 79e36721c09d0714a1f27a48227e14d6934ffbbb832d3097d082fbd65b9ce9d3b3418971bc66a7928c3e2e476ef24c62bfc80642da5d7b13e718a0995629d8b7
7
+ data.tar.gz: 03fbbb8896f81d8f8eb0082956a666f35df20c0b98ea30157cf8b5fe6f32e4f3c66ab976db2ff13258bc3929f9fbb8d810741b421006c824fe6852e3e24da4c7
@@ -35,9 +35,13 @@ module Trestle
35
35
  end
36
36
 
37
37
  def generate_migration
38
+ filename = 'migration.rb'
39
+ path = File.expand_path(find_in_source_paths(filename.to_s))
40
+ text = File.read(path)
41
+ content = text.gsub('[]', "[#{ActiveRecord::Migration.current_version}]")
42
+ File.open(path, "w") { |file| file << content }
38
43
 
39
- migration_template("migration.rb", "db/migrate/add_otp_fields.rb")
40
-
44
+ migration_template(filename, "db/migrate/add_otp_fields.rb")
41
45
  end
42
46
 
43
47
  def devise?
@@ -58,14 +62,22 @@ module Trestle
58
62
  path = File.expand_path(find_in_source_paths(path.to_s))
59
63
  context = options.delete(:context) || instance_eval("binding")
60
64
 
61
- capturable_erb = CapturableERB.new(::File.binread(path), trim_mode: "-", eoutvar: "@output_buffer")
62
-
63
- content = capturable_erb.tap do |erb|
65
+ content = capturable_erb(path).tap do |erb|
64
66
  erb.filename = path
65
67
  end.result(context)
66
68
  end
69
+
70
+ def capturable_erb(path)
71
+ match = ERB.version.match(/(\d+\.\d+\.\d+)/)
72
+
73
+ if match && match[1] >= "2.2.0" # Ruby 2.6+
74
+ CapturableERB.new(::File.binread(path), trim_mode: "-", eoutvar: "@output_buffer")
75
+ else
76
+ CapturableERB.new(::File.binread(path), nil, "-", "@output_buffer")
77
+ end
78
+ end
67
79
  end
68
80
  end
69
81
  end
70
82
  end
71
- end
83
+ end
@@ -1,4 +1,4 @@
1
- class AddOtpFields < ActiveRecord::Migration[6.0]
1
+ class AddOtpFields < ActiveRecord::Migration[]
2
2
  def up
3
3
  add_column :administrators, :otp_secret_key, :string
4
4
  add_column :administrators, :otp_module, :boolean, default: false
@@ -8,4 +8,4 @@ class AddOtpFields < ActiveRecord::Migration[6.0]
8
8
  remove_column :administrators, :otp_module
9
9
  remove_column :administrators, :otp_secret_key
10
10
  end
11
- end
11
+ end
@@ -1,7 +1,7 @@
1
1
  module Trestle
2
2
  module Auth
3
3
  module Otp
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
6
6
  end
7
7
  end
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "trestle", "~> 0.9.0"
24
24
  spec.add_dependency "trestle-auth", "~> 0.4.0"
25
25
  spec.add_dependency "active_model_otp", "~> 2.0"
26
- spec.add_dependency "rqrcode", "~> 1.1"
26
+ spec.add_dependency "rqrcode", "~> 2.0"
27
27
 
28
28
  spec.add_development_dependency "rspec-rails", "~> 3.0"
29
29
  spec.add_development_dependency "show_me_the_cookies", "~> 5.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trestle-auth-otp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emanuele Barban
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-28 00:00:00.000000000 Z
11
+ date: 2021-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trestle
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.1'
61
+ version: '2.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.1'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec-rails
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,8 +108,8 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.9.1
111
- description:
112
- email:
111
+ description:
112
+ email:
113
113
  executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
@@ -148,7 +148,7 @@ licenses:
148
148
  metadata:
149
149
  homepage_uri: https://www.trestle.io
150
150
  source_code_uri: https://github.com/McRipper/trestle-auth-otp
151
- post_install_message:
151
+ post_install_message:
152
152
  rdoc_options: []
153
153
  require_paths:
154
154
  - lib
@@ -163,8 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  requirements: []
166
- rubygems_version: 3.1.2
167
- signing_key:
166
+ rubygems_version: 3.0.3
167
+ signing_key:
168
168
  specification_version: 4
169
169
  summary: One Time Password plugin for the Trestle admin framework
170
170
  test_files: []