rails_base 0.55.0 → 0.56.0

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: 8398f2f9ada782b1537b579041f73318e78337f1f8f6101429cc126b80c1f5ba
4
- data.tar.gz: f5e0f80ac521a3a9605ee7b125e43dc188869f81f7a52d50677e26b6815edb25
3
+ metadata.gz: 8848ee352824c072f2cb33947b77f92e4516a2bb606fc327c0af9a13c0239eeb
4
+ data.tar.gz: d6a05900f769175ddda5500073ae3158eecd9442c71955f29fd770ee8f2ce65e
5
5
  SHA512:
6
- metadata.gz: 95e8b67852ba25a7520d67948078223371f19987a23f28e0cb4f45f9b04c3b2c758c5efe5a52cc1aab4f6471c5a3f3efe471a9b0d03428d74e50a2fcb74387a6
7
- data.tar.gz: e883ca59c6f57813396475e19b3862b30822ffc0d0c65ee799615b8933a26eb518469f329f66993407b23ce08b2f1f51c01a8d63d9e5f476da92466a38d14aa2
6
+ metadata.gz: dc283c62b445089c071258a6363a6bc77fd184ba19d34dd06d6ba26a7962b2a6b2ad31e47140af7ba1d682ce6275e9c7612d3e494ffab1d3c8e78d1604daefae
7
+ data.tar.gz: fc68932462a62c9b13738f9254d46026fdfcd2ff9f62da33032d747292c7eed50ac646a0a5f0982400cff1e7c9ae7e07f6f1514c95b07c1dd9f7bf3262c2be93
@@ -8,15 +8,22 @@ module RailsBase::Authentication
8
8
  delegate :user, to: :context
9
9
  delegate :reason, to: :context
10
10
 
11
- MAX_USE_COUNT = 1.freeze
12
11
  DATA_USE = :alphanumeric
13
12
  VELOCITY_MAX = 5
14
13
  VELOCITY_MAX_IN_FRAME = 10.minutes
15
14
  VELOCITY_FRAME = 1.hour
16
15
 
17
16
  REASON_MAPPER = {
18
- Constants::SVE_LOGIN_REASON => { method: :email_verification, url_method: :email_verification_url },
19
- Constants::SVE_FORGOT_REASON => { method: :forgot_password, url_method: :forgot_password_auth_url }
17
+ Constants::SVE_LOGIN_REASON => {
18
+ method: :email_verification,
19
+ url_method: :email_verification_url,
20
+ max_use: RailsBase.config.login_behavior.email_max_use_verification
21
+ },
22
+ Constants::SVE_FORGOT_REASON => {
23
+ method: :forgot_password,
24
+ url_method: :forgot_password_auth_url,
25
+ max_use: RailsBase.config.login_behavior.email_max_use_forgot
26
+ }
20
27
  }
21
28
 
22
29
  def call
@@ -61,7 +68,7 @@ module RailsBase::Authentication
61
68
  def create_short_lived_data
62
69
  params = {
63
70
  user: user,
64
- max_use: MAX_USE_COUNT,
71
+ max_use: REASON_MAPPER[reason][:max_use],
65
72
  reason: reason,
66
73
  data_use: DATA_USE,
67
74
  ttl: Constants::SVE_TTL,
@@ -9,7 +9,17 @@ module RailsBase
9
9
  type: :boolean,
10
10
  default: true,
11
11
  description: 'Enable capturing requests context when login fails. Upon login, redirect user to page they tried to go to.',
12
- }
12
+ },
13
+ email_max_use_verification:{
14
+ type: :integer,
15
+ default: 2,
16
+ description: 'Maximum number of times User can click link for verifiaction',
17
+ },
18
+ email_max_use_forgot:{
19
+ type: :integer,
20
+ default: 2,
21
+ description: 'Maximum number of times User can click link for forgot password flow',
22
+ },
13
23
  }
14
24
  attr_accessor *DEFAULT_VALUES.keys
15
25
  end
@@ -1,6 +1,6 @@
1
1
  module RailsBase
2
2
  MAJOR = '0'
3
- MINOR = '55'
3
+ MINOR = '56'
4
4
  PATCH = '0'
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_base
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.55.0
4
+ version: 0.56.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-04 00:00:00.000000000 Z
11
+ date: 2021-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails