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: 772039782b1938d4b3ce3b0ba5c83ddf074232156e48b103af7cc42872dc35c1
4
- data.tar.gz: 2cf65214f9ecc836a3510b4aa9da4fbbe81383f1bfe0169c23f0357c8a95ca02
3
+ metadata.gz: 396162cdf3bcc3f4ba7047056d649819ef06d4eb55b2f7886fec2e9fda0f3574
4
+ data.tar.gz: 1773336cfc454e2479b1c10670010b3090a650a67fbd5769a76bddeaf26f38a1
5
5
  SHA512:
6
- metadata.gz: 3a5b5b9c67909b2598379c86dd9ebed667c3b8f3ac5c011b03445087e8aeb48674c345909d7e70bf544e247861d70c63736c1dc459aaeae059e5098ea88243e6
7
- data.tar.gz: 360b1e2c0b6b7803ce1afcd39c38cd70c38ae758f8eb9b2d1c7f8e817f783ed61e842dcce848ea4c6ffb8ea8c74d592b2033868a460a7a913dc89fbf8da46811
6
+ metadata.gz: 2aa7b7946be5e4b3d425c8885bf02efdb3f2cb99859642fa9982672517e74c19c1495d205522670e6b153e0ded1b61e89df3160c9c5229cac7c0fa1e768a46fc
7
+ data.tar.gz: f7c033aa8618da88112a1f39427143d4bddc94028a09f902a4ea7b6c015b652765d461e87bd48ea9dd74764224fbbea4d8ec6301edf14c3261f29340439da536
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.7.1 (2026-02-07)
2
+
3
+ - Fixed error with certain custom Warden strategies
4
+
1
5
  ## 0.7.0 (2025-05-04)
2
6
 
3
7
  - Removed support for Rails < 7.1 and Ruby < 3.2
@@ -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 ||= auth.winning_strategy.class.name.split("::").last.underscore if auth.winning_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
@@ -1,3 +1,3 @@
1
1
  module AuthTrail
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -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, polymorphic: true
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.0
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: 3.6.7
76
+ rubygems_version: 4.0.3
77
77
  specification_version: 4
78
78
  summary: Track Devise login activity
79
79
  test_files: []