rails_jwt_auth 0.13.0 → 0.14.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
  SHA1:
3
- metadata.gz: 6422dfa2844d4062fa9da57c3db332748728dc20
4
- data.tar.gz: 3dcf6e65015ce00d28e65d4e0c40b85fff629d6a
3
+ metadata.gz: 84bbab8a21df1dc0ab2aa4f1a4b3cf6bcdeeb300
4
+ data.tar.gz: 8c70773e3fa6760e87060c6d7540e733ae4b964f
5
5
  SHA512:
6
- metadata.gz: 26d8f71f79d84c7bce92ce40e94e6694bcef9cd681be8bc2e28d83569524ea72666b9e0142e8109540311b6de1cad7faca502fdd0267cf6e5ddecbc829fb5023
7
- data.tar.gz: 452c77aea5c9c3e34efc52d71cc0bbb0a712b78cf54d376d9bf85486e3d852190c4a4358292c9cfcf312f9cd9fb028196986fe46aae91b3c56495c11f72af9c3
6
+ metadata.gz: e9a59be18b4bb7579f66ff79c1beae53ea8b125ed8a7b521d587113535491e6151a83ba4469306bab5b3a093edd83b1b3dbf2dbe54a2103cf689d15bc276da56
7
+ data.tar.gz: 6a4617b02cae8cc664eafbc08e315dcbd7cc6b171bd2013cda4266f5a1df6cbd47d783b415bf9f815843e0e82edfdd426f55c473a5d6346d8add9567cb86e5b9
data/README.md CHANGED
@@ -45,6 +45,7 @@ You can edit configuration options into `config/initializers/auth_token_auth.rb`
45
45
  | confirmation_expiration_time | 1.day | Confirmation token expiration time |
46
46
  | reset_password_url | password_path | Url used to create email link with reset password token |
47
47
  | reset_password_expiration_time | 1.day | Confirmation token expiration time |
48
+ | deliver_later | false | Uses `deliver_later` method to send emails |
48
49
 
49
50
  ## Authenticatable
50
51
 
@@ -8,8 +8,10 @@ module RailsJwtAuth
8
8
 
9
9
  self.confirmation_token = SecureRandom.base58(24)
10
10
  self.confirmation_sent_at = Time.now
11
+ return false unless save
11
12
 
12
- Mailer.confirmation_instructions(self).deliver if save
13
+ mailer = Mailer.confirmation_instructions(self)
14
+ RailsJwtAuth.deliver_later ? mailer.deliver_later : mailer.deliver
13
15
  end
14
16
 
15
17
  def confirmed?
@@ -38,6 +40,10 @@ module RailsJwtAuth
38
40
 
39
41
  def self.included(base)
40
42
  if base.ancestors.include? Mongoid::Document
43
+ # include GlobalID::Identification to use deliver_later method
44
+ # http://edgeguides.rubyonrails.org/active_job_basics.html#globalid
45
+ base.send(:include, GlobalID::Identification) if RailsJwtAuth.deliver_later
46
+
41
47
  base.send(:field, :email, type: String)
42
48
  base.send(:field, :unconfirmed_email, type: String)
43
49
  base.send(:field, :confirmation_token, type: String)
@@ -8,8 +8,10 @@ module RailsJwtAuth
8
8
 
9
9
  self.reset_password_token = SecureRandom.base58(24)
10
10
  self.reset_password_sent_at = Time.now
11
+ return false unless save
11
12
 
12
- Mailer.reset_password_instructions(self).deliver if save
13
+ mailer = Mailer.reset_password_instructions(self)
14
+ RailsJwtAuth.deliver_later ? mailer.deliver_later : mailer.deliver
13
15
  end
14
16
 
15
17
  def reset_password_in_progress?
@@ -19,6 +21,10 @@ module RailsJwtAuth
19
21
 
20
22
  def self.included(base)
21
23
  if base.ancestors.include? Mongoid::Document
24
+ # include GlobalID::Identification to use deliver_later method
25
+ # http://edgeguides.rubyonrails.org/active_job_basics.html#globalid
26
+ base.send(:include, GlobalID::Identification) if RailsJwtAuth.deliver_later
27
+
22
28
  base.send(:field, :reset_password_token, type: String)
23
29
  base.send(:field, :reset_password_sent_at, type: Time)
24
30
  end
@@ -31,4 +31,7 @@ RailsJwtAuth.setup do |config|
31
31
 
32
32
  # expiration time for reset password tokens
33
33
  #config.reset_password_expiration_time = 1.day
34
+
35
+ # uses deliver_later to send emails instead of deliver method
36
+ #config.deliver_later = false
34
37
  end
@@ -37,6 +37,9 @@ module RailsJwtAuth
37
37
  mattr_accessor :reset_password_expiration_time
38
38
  @@reset_password_expiration_time = 1.day
39
39
 
40
+ mattr_accessor :deliver_later
41
+ @@deliver_later = false
42
+
40
43
  def self.model
41
44
  @@model_name.constantize
42
45
  end
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '0.13.0'
2
+ VERSION = '0.14.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado