auth_activity 0.1.3 → 0.1.4
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 +5 -5
- data/app/mailers/auth_activity/application_mailer.rb +6 -0
- data/app/mailers/auth_activity/user_mailer.rb +11 -0
- data/app/models/concerns/auth_activity/user.rb +23 -11
- data/app/views/auth_activity/auth_events/index.html.erb +1 -1
- data/app/views/auth_activity/user_mailer/password_changed.html.erb +2 -0
- data/app/views/layouts/auth_activity/mailer.html.erb +13 -0
- data/app/views/layouts/auth_activity/mailer.text.erb +1 -0
- data/config/locales/en.yml +3 -0
- data/lib/auth_activity/version.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f82ede4f51f2663e17393e2959b0e5f719743fed770bd734df1d1b528148266f
|
4
|
+
data.tar.gz: 2074e32f692e6b558209b7a12ef228f827b4080a1ba9f15b071b947f36d437ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b29277bff373bf247c4a0a740f769a48cb4d1028e85484330203fc8a4637b85e736261f3fb005c2a113aaf0b8f0f42f865afdaf967fa9c8d7ba902f463b3325
|
7
|
+
data.tar.gz: 96cb6ed9980c09bd60412695c1b019284cfc9af0ffd72efd49cfc35a09686ecaf6f8f25fa3daf6e207dc4190cebb53fe08a5bbe96b03abadae70180c3ef894e1
|
@@ -1,14 +1,18 @@
|
|
1
1
|
module AuthActivity::User
|
2
|
-
AUTH_ATTRIBUTES = %w[email encrypted_password]
|
3
|
-
FILTER_ATTRIBUTES = %w[encrypted_password]
|
2
|
+
AUTH_ATTRIBUTES = %w[email encrypted_password].freeze
|
3
|
+
FILTER_ATTRIBUTES = %w[encrypted_password].freeze
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
after_update :log_changed
|
7
|
+
after_update :log_changed, :send_password_changed_email
|
8
8
|
after_create :log_created
|
9
9
|
after_destroy :log_destroyed
|
10
10
|
end
|
11
11
|
|
12
|
+
def plausible_name
|
13
|
+
try(:full_name) || try(:name) || [try(:first_name), try(:last_name)].compact.join(" ")
|
14
|
+
end
|
15
|
+
|
12
16
|
private
|
13
17
|
|
14
18
|
def log_created
|
@@ -17,7 +21,10 @@ module AuthActivity::User
|
|
17
21
|
|
18
22
|
def log_changed
|
19
23
|
return unless changed_auth_attributes.any?
|
20
|
-
|
24
|
+
|
25
|
+
AuthActivity::AuthEvent.
|
26
|
+
attributes_changed.create!(trackable: self,
|
27
|
+
metadata: { attributes_changed: filtered_auth_changes })
|
21
28
|
end
|
22
29
|
|
23
30
|
def log_destroyed
|
@@ -29,16 +36,21 @@ module AuthActivity::User
|
|
29
36
|
end
|
30
37
|
|
31
38
|
def filtered_auth_changes
|
32
|
-
auth_changes.update(auth_changes) do |k,v|
|
33
|
-
if k.in? FILTER_ATTRIBUTES
|
34
|
-
|
35
|
-
|
36
|
-
{ k => v }
|
37
|
-
end
|
39
|
+
auth_changes.update(auth_changes) do |k, v|
|
40
|
+
return { k => ["[filtered]", "[filtered]"] } if k.in? FILTER_ATTRIBUTES
|
41
|
+
|
42
|
+
{ k => v }
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
41
46
|
def auth_changes
|
42
|
-
saved_changes.select { |k
|
47
|
+
saved_changes.select { |k| k.in?(changed_auth_attributes) }
|
48
|
+
end
|
49
|
+
|
50
|
+
def send_password_changed_email
|
51
|
+
return unless AuthActivity::Engine.config.enable_password_changed_email
|
52
|
+
return unless saved_changes.key?(:encrypted_password)
|
53
|
+
|
54
|
+
UserMailer.password_changed(self).deliver_later
|
43
55
|
end
|
44
56
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auth_activity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michiel Sikkes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -86,12 +86,15 @@ files:
|
|
86
86
|
- app/controllers/auth_activity/application_controller.rb
|
87
87
|
- app/controllers/auth_activity/auth_events_controller.rb
|
88
88
|
- app/controllers/concerns/auth_activity/auth_logger.rb
|
89
|
+
- app/mailers/auth_activity/application_mailer.rb
|
90
|
+
- app/mailers/auth_activity/user_mailer.rb
|
89
91
|
- app/models/auth_activity/application_record.rb
|
90
92
|
- app/models/auth_activity/auth_event.rb
|
91
93
|
- app/models/auth_activity/current.rb
|
92
94
|
- app/models/concerns/auth_activity/user.rb
|
93
95
|
- app/views/auth_activity/auth_events/_auth_event.html.erb
|
94
96
|
- app/views/auth_activity/auth_events/index.html.erb
|
97
|
+
- app/views/auth_activity/user_mailer/password_changed.html.erb
|
95
98
|
- app/views/kaminari/_first_page.html.erb
|
96
99
|
- app/views/kaminari/_gap.html.erb
|
97
100
|
- app/views/kaminari/_last_page.html.erb
|
@@ -100,6 +103,9 @@ files:
|
|
100
103
|
- app/views/kaminari/_paginator.html.erb
|
101
104
|
- app/views/kaminari/_prev_page.html.erb
|
102
105
|
- app/views/layouts/auth_activity/application.html.erb
|
106
|
+
- app/views/layouts/auth_activity/mailer.html.erb
|
107
|
+
- app/views/layouts/auth_activity/mailer.text.erb
|
108
|
+
- config/locales/en.yml
|
103
109
|
- config/routes.rb
|
104
110
|
- db/migrate/20180914084603_create_auth_activity_auth_events.rb
|
105
111
|
- db/migrate/20180914211658_make_trackable_polymorphic.rb
|
@@ -126,8 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
132
|
- !ruby/object:Gem::Version
|
127
133
|
version: '0'
|
128
134
|
requirements: []
|
129
|
-
|
130
|
-
rubygems_version: 2.5.2.3
|
135
|
+
rubygems_version: 3.0.4
|
131
136
|
signing_key:
|
132
137
|
specification_version: 4
|
133
138
|
summary: Authorisation auditing
|