authtrail 0.7.0 → 0.7.1
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 396162cdf3bcc3f4ba7047056d649819ef06d4eb55b2f7886fec2e9fda0f3574
|
|
4
|
+
data.tar.gz: 1773336cfc454e2479b1c10670010b3090a650a67fbd5769a76bddeaf26f38a1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2aa7b7946be5e4b3d425c8885bf02efdb3f2cb99859642fa9982672517e74c19c1495d205522670e6b153e0ded1b61e89df3160c9c5229cac7c0fa1e768a46fc
|
|
7
|
+
data.tar.gz: f7c033aa8618da88112a1f39427143d4bddc94028a09f902a4ea7b6c015b652765d461e87bd48ea9dd74764224fbbea4d8ec6301edf14c3261f29340439da536
|
data/CHANGELOG.md
CHANGED
data/lib/auth_trail/manager.rb
CHANGED
|
@@ -31,7 +31,16 @@ module AuthTrail
|
|
|
31
31
|
|
|
32
32
|
def detect_strategy(auth)
|
|
33
33
|
strategy = auth.env["omniauth.auth"]["provider"] if auth.env["omniauth.auth"]
|
|
34
|
-
strategy
|
|
34
|
+
if !strategy && auth.winning_strategy
|
|
35
|
+
winning_class = auth.winning_strategy.class
|
|
36
|
+
strategy =
|
|
37
|
+
if winning_class.name
|
|
38
|
+
winning_class.name.split("::").last.underscore
|
|
39
|
+
else
|
|
40
|
+
# rescue since _strategies is private
|
|
41
|
+
(Warden::Strategies._strategies.key(winning_class)&.to_s rescue nil) || "unknown"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
35
44
|
strategy ||= "database_authenticatable"
|
|
36
45
|
strategy
|
|
37
46
|
end
|
data/lib/auth_trail/version.rb
CHANGED
|
@@ -78,6 +78,18 @@ module Authtrail
|
|
|
78
78
|
def adapter
|
|
79
79
|
ActiveRecord::Base.connection_db_config.adapter.to_s
|
|
80
80
|
end
|
|
81
|
+
|
|
82
|
+
def primary_key_type
|
|
83
|
+
", id: :#{key_type}" if key_type
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def foreign_key_type
|
|
87
|
+
", type: :#{key_type}" if key_type
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def key_type
|
|
91
|
+
Rails.configuration.generators.options.dig(:active_record, :primary_key_type)
|
|
92
|
+
end
|
|
81
93
|
end
|
|
82
94
|
end
|
|
83
95
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version %>
|
|
2
2
|
def change
|
|
3
|
-
create_table :login_activities do |t|
|
|
3
|
+
create_table :login_activities<%= primary_key_type %> do |t|
|
|
4
4
|
t.string :scope
|
|
5
5
|
t.string :strategy
|
|
6
6
|
<%= identity_column %>
|
|
7
7
|
t.boolean :success
|
|
8
8
|
t.string :failure_reason
|
|
9
|
-
t.references :user
|
|
9
|
+
t.references :user<%= foreign_key_type %>, polymorphic: true
|
|
10
10
|
t.string :context
|
|
11
11
|
<%= ip_column %>
|
|
12
12
|
t.text :user_agent
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authtrail
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
74
|
version: '0'
|
|
75
75
|
requirements: []
|
|
76
|
-
rubygems_version:
|
|
76
|
+
rubygems_version: 4.0.3
|
|
77
77
|
specification_version: 4
|
|
78
78
|
summary: Track Devise login activity
|
|
79
79
|
test_files: []
|