two_factor_cookies 0.1.2 → 0.1.3

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: 8ccf0f45cecbc377af4bd82b5ac202731a8c09e160202199dd6133a613bbcc2c
4
- data.tar.gz: 20d7518de754fbfe4fe5c58cd820d0d04544a55497485ce3ab22967d954cd7ba
3
+ metadata.gz: 10a72f05a70280e9ada50334d5e7b241b8938141b1dddd4a4a983e86e8e173ae
4
+ data.tar.gz: 759b972a8020bdc4af1c8e8b84c40f321b2d99279d42aa44cb61f7c0ded01185
5
5
  SHA512:
6
- metadata.gz: 696b69c8e9b4b08dbc886b5c7cbcb0fb1b7a085dc92488eecd3d8bcb1b430df5873b6196cc18d5612c1b179fb63a1a1aabaad1fd0e5cfbf622fe66e073ee38ee
7
- data.tar.gz: e29110160189fe56898b998b68f33bff6d68af084773c57ea7791f68633b71f2f96371ff3cac01e9efb1c89ddc15c8ed0d9453ad1c6d759c7ade83ef33b6af52
6
+ metadata.gz: 5d4d650b8a5ee61507f05dd2d76c0a9f808acf104a9bdfab79f6f1b8736758548242a192dd0cbf8eddc7f17afe092ab790744b7a166ebd7e78044ceecbd6a79b
7
+ data.tar.gz: e666f468fd3ef60f28281cb9d67476e1e3ab79bef4b4677147fc2aaec123108cba4a735cc3558cd4a545189f4fbcc13004d7aa0c538a99df283b810113f6f513
data/README.md CHANGED
@@ -119,14 +119,10 @@ Toggling two factor on and off is handled by the `ToggleTwoFactorController` in
119
119
  `user` in the param is the name of the user model in the app, taken from the configuration. If enabled_two_factor is '1', two factor is toggled on. If enabled_two_factor is anything else, two factor will be toggled off
120
120
 
121
121
  #### Logging
122
- The gem can be configured to log, when 2fa is toggled on or off. To do this you must configure `logging_module` with a module that has `log` defined in whatever way makes sense in your project. The method will be passed a message consisting of a translation with a user id.
123
- ```
124
- module Log
125
- extend ActiveSupport::Concern
126
-
127
- def log(message)
128
- Rails.logger.info message
129
- end
122
+ The gem can be configured to log, when 2fa is toggled on or off. To do this you must configure `logging_method_name` with the name of a method, you implement, that logs in whatever way makes sense in your project. The method will be passed a message consisting of a translation with a user id.
123
+ ```ruby
124
+ def log(message)
125
+ Rails.logger.info message
130
126
  end
131
127
  ```
132
128
 
@@ -1,7 +1,5 @@
1
1
  TwoFactorCookies.const_set('ToggleTwoFactorController',
2
2
  Class.new('TwoFactorCookies::TwoFactorAuthenticationController'.constantize) do
3
- include TwoFactorCookies.configuration.logging_module.constantize if TwoFactorCookies.configuration.logging_module
4
-
5
3
  def update
6
4
  if TwoFactorCookies::OneTimePasswordGenerator.verify_code(
7
5
  confirm_phone_number_params[:one_time_password],
@@ -25,11 +23,11 @@ TwoFactorCookies.const_set('ToggleTwoFactorController',
25
23
  current_user.enable_two_factor!
26
24
  current_user.update(update_params) if TwoFactorCookies.configuration.update_params
27
25
  set_authenticated_cookie
28
- log(I18n.t('two_factor_cookies.logger.toggle_2fa_on', id: current_user.id)) if TwoFactorCookies.configuration.logging_module
26
+ public_send(TwoFactorCookies.configuration.logging_method_name, I18n.t('two_factor_cookies.logger.toggle_2fa_on', id: current_user.id)) if TwoFactorCookies.configuration.logging_method_name
29
27
  else
30
28
  current_user.disable_two_factor!
31
29
  current_user.disaffirm_phone_number!
32
- log(I18n.t('two_factor_cookies.logger.toggle_2fa_off', id: current_user.id)) if TwoFactorCookies.configuration.logging_module
30
+ public_send(TwoFactorCookies.configuration.logging_method_name, I18n.t('two_factor_cookies.logger.toggle_2fa_off', id: current_user.id)) if TwoFactorCookies.configuration.logging_method_name
33
31
  end
34
32
 
35
33
  redirect_to eval(TwoFactorCookies.configuration.engine_name).public_send(
@@ -4,7 +4,7 @@ module TwoFactorCookies
4
4
  :toggle_two_factor_success_route, :two_factor_authentication_expiry, :otp_expiry, :twilio_account_sid,
5
5
  :twilio_phone_number, :twilio_auth_token, :phone_number_field_name, :user_model_name, :username_field_name,
6
6
  :two_factor_authentication_controller_parent, :skip_before_action, :layout_path, :additional_authentication_values,
7
- :update_params, :engine_name, :logging_module
7
+ :update_params, :engine_name, :logging_method_name
8
8
 
9
9
  def initialize
10
10
  @otp_generation_secret_key = nil
@@ -24,7 +24,7 @@ module TwoFactorCookies
24
24
  @confirm_phone_number_success_route = nil
25
25
  @layout_path = nil
26
26
  @two_factor_authentication_controller_parent = '::ApplicationController'
27
- @logging_module = nil
27
+ @logging_method_name = nil
28
28
 
29
29
  @additional_authentication_values = {}
30
30
 
@@ -1,3 +1,3 @@
1
1
  module TwoFactorCookies
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: two_factor_cookies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolai Bach Woller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-19 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails