devise_revokable 0.0.2 → 0.0.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.
@@ -21,8 +21,11 @@ It works like normal Devise modules. Add the <tt>:revokable</tt> module to the
21
21
  # in user.rb
22
22
  devise :revokable # plus other devise modules
23
23
 
24
- Additionally, you will need to override <tt>#revoke!</tt> to actually perfom the revocation on your account, which
25
- is yielded to from the module's method.
24
+ If the user who received the revocation email follows the provided link and confirms revocation, the account will
25
+ effectively be "revoked" and inactive, unable to log in.
26
+
27
+ Additionally, you may want to override <tt>#revoke!</tt> to perfom additional revocation on the account, e.g. deleting
28
+ posts made, resetting personal information, etc. The super method yields to a block for this purpose.
26
29
 
27
30
  # in user.rb
28
31
  def revoke!
@@ -36,8 +39,8 @@ Additionally you can define the module accessor <tt>@@mailer</tt> on the module
36
39
  This proc is yielded two arguments, the method name (e.g. :revocation_instructions), and the affected resource.
37
40
 
38
41
 
39
- # in config/initializers/devise_revocation.rb
40
- require 'devise_revocation'
42
+ # in config/initializers/devise_revokable.rb
43
+ require 'devise_revokable'
41
44
  require 'my_mailer'
42
45
 
43
- DeviseRevocation.mailer = proc {|method_name, resource| MyMailer.send(:method_name, resource) }
46
+ DeviseRevokable.mailer = proc {|method_name, resource| MyMailer.send(:method_name, resource) }
@@ -1,5 +1,7 @@
1
1
  en:
2
2
  devise:
3
+ failure:
4
+ revoked: 'Your account has been revoked, please contact the administrator if you feel this is in error.'
3
5
  revocations:
4
6
  updated: 'Your account was reset successfully.'
5
7
  revocation_token_invalid: 'The token provided is not valid, or this account has already been revoked!'
@@ -27,11 +27,11 @@ module Devise
27
27
  end
28
28
 
29
29
  def active?
30
- not revoked?
30
+ super && !revoked?
31
31
  end
32
32
 
33
33
  def inactive_message
34
- super
34
+ revoked? ? :revoked : super
35
35
  end
36
36
 
37
37
  protected
@@ -66,7 +66,6 @@ module Devise
66
66
 
67
67
  module ClassMethods
68
68
  def send_revocation_instructions(attributes = {})
69
- return unless active?
70
69
  revokable = find_or_initialize_with_error_by(:email, attributes[:email], :not_found)
71
70
  revokable.send(:send_revocation_instructions) if revokable.persisted?
72
71
  revokable
@@ -1,3 +1,3 @@
1
1
  module DeviseRevokable
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Travis Cox
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-18 00:00:00 -04:00
17
+ date: 2011-03-22 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -71,8 +71,11 @@ description: |
71
71
  # in user.rb
72
72
  devise :revokable # plus other devise modules
73
73
 
74
- Additionally, you will need to override <tt>#revoke!</tt> to actually perfom the revocation on your account, which
75
- is yielded to from the module's method.
74
+ If the user who received the revocation email follows the provided link and confirms revocation, the account will
75
+ effectively be "revoked" and inactive, unable to log in.
76
+
77
+ Additionally, you may want to override <tt>#revoke!</tt> to perfom additional revocation on the account, e.g. deleting
78
+ posts made, resetting personal information, etc. The super method yields to a block for this purpose.
76
79
 
77
80
  # in user.rb
78
81
  def revoke!
@@ -86,11 +89,11 @@ description: |
86
89
  This proc is yielded two arguments, the method name (e.g. :revocation_instructions), and the affected resource.
87
90
 
88
91
 
89
- # in config/initializers/devise_revocation.rb
90
- require 'devise_revocation'
92
+ # in config/initializers/devise_revokable.rb
93
+ require 'devise_revokable'
91
94
  require 'my_mailer'
92
95
 
93
- DeviseRevocation.mailer = proc {|method_name, resource| MyMailer.send(:method_name, resource) }
96
+ DeviseRevokable.mailer = proc {|method_name, resource| MyMailer.send(:method_name, resource) }
94
97
 
95
98
  email: travis@e9digital.com
96
99
  executables: []