authtrail 0.4.2 → 0.5.0

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: ff58207c013a0181500aea1886029896cae2af4fe0cf8dbf65bd1545e0637f4a
4
- data.tar.gz: f2b530b002daaa2ca52f2dbf471199e9fcfc13c04c9c821df139b9e6e909eecc
3
+ metadata.gz: b961a98fb477c8b4eeb74ee2ad5fc3ede159438538361c6d6b4dc4acee17aabf
4
+ data.tar.gz: 77616ad77bce39a9223b75a289b5f4ea5c23412cdf82a76a697fdf9dad77b4f9
5
5
  SHA512:
6
- metadata.gz: 94ec2b6986bef058156630c1dccf900c366f1b9c2aaf84703c5372370dbf305af698c554c9e1b5f0ca64d144cd934c065499ac745c711a98d8dfe33c3138ed5b
7
- data.tar.gz: ae73465fd479199a31cabed9a87a6afdf6acca838de32c8b329f2da061709229046812584dfce1a9a8fdb4650834a5b2a4f2928ac7ea0d6e0cbf50da98e2c4c2
6
+ metadata.gz: 783acd6518405cc4f28eb9480b4556b90a188690f12d1bdb388d38316a5381dd2df55d8e65d6faa87f39ce84563ba0ddba7ef17620e82c63cda171a3abe06573
7
+ data.tar.gz: 676726af0dcb1e88e5970741d374420c8f219069e86032cdd6a581f12ca09bb574b2930fff196f958741bdb2aaec73998e6f3fffe4e64970ec097bf24db8514c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.5.0 (2023-07-02)
2
+
3
+ - Made Active Record and Active Job optional
4
+ - Removed support for Rails < 6.1 and Ruby < 3
5
+
6
+ ## 0.4.3 (2022-06-12)
7
+
8
+ - Updated install generator for Lockbox 1.0
9
+
1
10
  ## 0.4.2 (2021-12-13)
2
11
 
3
12
  - Added experimental support for Active Record encryption
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017-2021 Andrew Kane
1
+ Copyright (c) 2017-2023 Andrew Kane
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Track Devise login activity
4
4
 
5
- **AuthTrail 0.4.0 was recently released** - see [how to upgrade](#upgrading)
6
-
7
5
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
8
6
 
9
7
  [![Build Status](https://github.com/ankane/authtrail/workflows/build/badge.svg?branch=master)](https://github.com/ankane/authtrail/actions)
@@ -13,7 +11,7 @@ Track Devise login activity
13
11
  Add this line to your application’s Gemfile:
14
12
 
15
13
  ```ruby
16
- gem 'authtrail'
14
+ gem "authtrail"
17
15
  ```
18
16
 
19
17
  To encrypt email and IP addresses with Lockbox, install [Lockbox](https://github.com/ankane/lockbox) and [Blind Index](https://github.com/ankane/blind_index) and run:
@@ -23,7 +21,7 @@ rails generate authtrail:install --encryption=lockbox
23
21
  rails db:migrate
24
22
  ```
25
23
 
26
- To use Active Record encryption (Rails 7+, experimental, unreleased), run:
24
+ To use Active Record encryption (Rails 7+, experimental), run:
27
25
 
28
26
  ```sh
29
27
  rails generate authtrail:install --encryption=activerecord
@@ -118,7 +116,7 @@ AuthTrail uses [Geocoder](https://github.com/alexreisner/geocoder) for geocoding
118
116
  To enable geocoding, add this line to your application’s Gemfile:
119
117
 
120
118
  ```ruby
121
- gem 'geocoder'
119
+ gem "geocoder"
122
120
  ```
123
121
 
124
122
  And update `config/initializers/authtrail.rb`:
@@ -135,13 +133,17 @@ AuthTrail.job_queue = :low_priority
135
133
 
136
134
  ### Local Geocoding
137
135
 
138
- For privacy and performance, we recommend geocoding locally. Add this line to your application’s Gemfile:
136
+ For privacy and performance, we recommend geocoding locally.
137
+
138
+ For city-level geocoding, download the [GeoLite2 City database](https://dev.maxmind.com/geoip/geoip2/geolite2/).
139
+
140
+ Add this line to your application’s Gemfile:
139
141
 
140
142
  ```ruby
141
- gem 'maxminddb'
143
+ gem "maxminddb"
142
144
  ```
143
145
 
144
- For city-level geocoding, download the [GeoLite2 City database](https://dev.maxmind.com/geoip/geoip2/geolite2/) and create `config/initializers/geocoder.rb` with:
146
+ And create `config/initializers/geocoder.rb` with:
145
147
 
146
148
  ```ruby
147
149
  Geocoder.configure(
@@ -158,6 +160,12 @@ For country-level geocoding, install the `geoip-database` package. It’s preins
158
160
  sudo apt-get install geoip-database
159
161
  ```
160
162
 
163
+ Add this line to your application’s Gemfile:
164
+
165
+ ```ruby
166
+ gem "geoip"
167
+ ```
168
+
161
169
  And create `config/initializers/geocoder.rb` with:
162
170
 
163
171
  ```ruby
@@ -221,7 +229,7 @@ There are two notable changes to geocoding:
221
229
  2. The `geocoder` gem is now an optional dependency. To use geocoding, add it to your Gemfile:
222
230
 
223
231
  ```ruby
224
- gem 'geocoder'
232
+ gem "geocoder"
225
233
  ```
226
234
 
227
235
  ### 0.2.0
@@ -1,3 +1,3 @@
1
1
  module AuthTrail
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
data/lib/authtrail.rb CHANGED
@@ -2,11 +2,12 @@
2
2
  require "warden"
3
3
 
4
4
  # modules
5
- require "auth_trail/engine"
6
- require "auth_trail/manager"
7
- require "auth_trail/version"
5
+ require_relative "auth_trail/manager"
6
+ require_relative "auth_trail/version"
8
7
 
9
8
  module AuthTrail
9
+ autoload :GeocodeJob, "auth_trail/geocode_job"
10
+
10
11
  class << self
11
12
  attr_accessor :exclude_method, :geocode, :track_method, :identity_method, :job_queue, :transform_method
12
13
  end
@@ -22,7 +22,7 @@ module Authtrail
22
22
  def generate_model
23
23
  case encryption
24
24
  when "lockbox"
25
- template "model_lockbox.rb", "app/models/login_activity.rb"
25
+ template "model_lockbox.rb", "app/models/login_activity.rb", lockbox_method: lockbox_method
26
26
  when "activerecord"
27
27
  template "model_activerecord.rb", "app/models/login_activity.rb"
28
28
  else
@@ -70,6 +70,14 @@ module Authtrail
70
70
  abort "Error: encryption must be lockbox, activerecord, or none"
71
71
  end
72
72
  end
73
+
74
+ def lockbox_method
75
+ if defined?(Lockbox::VERSION) && Lockbox::VERSION.to_i < 1
76
+ "encrypts"
77
+ else
78
+ "has_encrypted"
79
+ end
80
+ end
73
81
  end
74
82
  end
75
83
  end
@@ -1,7 +1,7 @@
1
1
  class LoginActivity < ApplicationRecord
2
2
  belongs_to :user, polymorphic: true, optional: true
3
3
 
4
- encrypts :identity, :ip
4
+ <%= lockbox_method %> :identity, :ip
5
5
  blind_index :identity, :ip
6
6
 
7
7
  before_save :reduce_precision
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authtrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-14 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
27
- - !ruby/object:Gem::Dependency
28
- name: activerecord
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '5.2'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '5.2'
26
+ version: '6.1'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: warden
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,8 +47,7 @@ files:
61
47
  - CHANGELOG.md
62
48
  - LICENSE.txt
63
49
  - README.md
64
- - app/jobs/auth_trail/geocode_job.rb
65
- - lib/auth_trail/engine.rb
50
+ - lib/auth_trail/geocode_job.rb
66
51
  - lib/auth_trail/manager.rb
67
52
  - lib/auth_trail/version.rb
68
53
  - lib/authtrail.rb
@@ -84,14 +69,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
69
  requirements:
85
70
  - - ">="
86
71
  - !ruby/object:Gem::Version
87
- version: '2.6'
72
+ version: '3'
88
73
  required_rubygems_version: !ruby/object:Gem::Requirement
89
74
  requirements:
90
75
  - - ">="
91
76
  - !ruby/object:Gem::Version
92
77
  version: '0'
93
78
  requirements: []
94
- rubygems_version: 3.2.32
79
+ rubygems_version: 3.4.10
95
80
  signing_key:
96
81
  specification_version: 4
97
82
  summary: Track Devise login activity
@@ -1,7 +0,0 @@
1
- require "active_support"
2
- require "rails/engine"
3
-
4
- module AuthTrail
5
- class Engine < Rails::Engine
6
- end
7
- end
File without changes