audit-log 0.2.0 → 0.2.1

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: ff47ceeaafa81e2d3304bb1af31fb95c8452259143fda90885098f19cf845629
4
- data.tar.gz: d02286a6864dae879eebf298ab978843b21ec1917090f676ec9855f1efe00075
3
+ metadata.gz: 3f683b75551b46a4dd5799d3699c235765c742d7f0e36e0d51fb3b8f06354e1b
4
+ data.tar.gz: ccd650c70feeae9b584b5b566c95e5d7b4d1a7e1fb6496d20915cf7f9e1ebbfd
5
5
  SHA512:
6
- metadata.gz: 0cc4a89d75d0003e9e321dfc92c03e7ae1fb50abf1cb8ecfce22f92ec099ef884917671641496c1040490dac058b1167664e531fff3f2c9ce7f92f0e4e9bbe69
7
- data.tar.gz: d1e3b71587b23079eb19b7b05c0b5520bcdd2a79f236d18d4e041343abdda15fa5c5a73d2691d21727d31af41d53e505799fe8dd724a932282b485cb250c87f9
6
+ metadata.gz: 32954d87892042d6871f9b66e2b808270aef6a167c0d6fab63f85ec3a0de538047890e99d8cd3493486176e9eae89cac16e750ed3838b39dcd9190f41793789b
7
+ data.tar.gz: 5f8e1a81880d4430bf07cb9af7c8acc5ff5caadcfcac63e5c8ffd87524c5c7cdb63ca204357ec318e40e1c7f7d4cb9f83ce3db69159d818f6aad2d584e215e2b
data/README.md CHANGED
@@ -113,6 +113,25 @@ zh-CN:
113
113
  approve_ticket: 审批工单
114
114
  ```
115
115
 
116
+ For track Warden (Devise) sign in behavirs:
117
+
118
+ config/initializes/devise.rb
119
+
120
+ ```rb
121
+ Warden::Manager.after_authentication do |user, auth, opts|
122
+ request = ActionDispatch::Request.new(auth.env)
123
+ AuditLog.audit!(:sign_in, user, payload: opts, user: user, request: request)
124
+ end
125
+
126
+ Warden::Manager.before_failure do |env, opts|
127
+ request = ActionDispatch::Request.new(env)
128
+ email = request.params.dig(:user, :email)
129
+ user = User.find_by_email(email)
130
+ opts[:email] = email
131
+ AuditLog.audit!(:sign_in_failure, nil, payload: opts, request: request, user: user)
132
+ end
133
+ ```
134
+
116
135
  ## License
117
136
 
118
137
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -46,7 +46,7 @@ module AuditLog
46
46
  end
47
47
 
48
48
  # Get I18n action name options for select
49
- def action_options(locale: I18n.default_locale)
49
+ def action_options(locale: I18n.locale)
50
50
  I18n.backend.send(:translations)[locale][:audit_log][:action].map { |k, v| [v, k.to_s] }
51
51
  end
52
52
  end
@@ -1,3 +1,3 @@
1
1
  module AuditLog
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audit-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-14 00:00:00.000000000 Z
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari