devise_invitable 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise_invitable might be problematic. Click here for more details.

@@ -169,6 +169,13 @@ If you want to create the invitation but not send it, you can set <tt>skip_invit
169
169
  end
170
170
  # => the record will be created, but the invitation email will not be sent
171
171
 
172
+ When skip_invitation is used, you must also then set the invitation_sent_at field when the user is sent their
173
+ token. Failure to do so will yield "Invalid invitation token" errors when the user attempts to accept the invite.
174
+ You can set it like so:
175
+
176
+ user.invitation_sent_at = Time.now.utc
177
+ user.save!
178
+
172
179
  You can add :skip_invitation to attributes hash if skip_invitation is added to attr_accessible.
173
180
 
174
181
  User.invite!(:email => "new_user@example.com", :name => "John Doe", :skip_invitation => true)
@@ -1,9 +1,9 @@
1
1
  class Devise::InvitationsController < DeviseController
2
2
 
3
- before_filter :authenticate_inviter!, :only => [:new, :create]
4
- before_filter :has_invitations_left?, :only => [:create]
5
- before_filter :require_no_authentication, :only => [:edit, :update, :destroy]
6
- before_filter :resource_from_invitation_token, :only => [:edit, :destroy]
3
+ prepend_before_filter :authenticate_inviter!, :only => [:new, :create]
4
+ prepend_before_filter :has_invitations_left?, :only => [:create]
5
+ prepend_before_filter :require_no_authentication, :only => [:edit, :update, :destroy]
6
+ prepend_before_filter :resource_from_invitation_token, :only => [:edit, :destroy]
7
7
  helper_method :after_sign_in_path_for
8
8
 
9
9
  # GET /resource/invitation/new
@@ -41,12 +41,12 @@ module Devise
41
41
 
42
42
  attr_writer :skip_password
43
43
 
44
- scope :active, lambda { where(:confirmation_token => nil) }
44
+ scope :active, lambda { where(:invitation_token => nil) }
45
45
  if defined?(Mongoid) && self < Mongoid::Document
46
- scope :invitation_not_accepted, lambda { where(:invitation_accepted_at => nil, :confirmation_token.ne => nil) }
46
+ scope :invitation_not_accepted, lambda { where(:invitation_accepted_at => nil, :invitation_token.ne => nil) }
47
47
  scope :invitation_accepted, lambda { where(:invitation_accepted_at.ne => nil) }
48
48
  else
49
- scope :invitation_not_accepted, lambda { where(arel_table[:confirmation_token].not_eq(nil)).where(:invitation_accepted_at => nil) }
49
+ scope :invitation_not_accepted, lambda { where(arel_table[:invitation_token].not_eq(nil)).where(:invitation_accepted_at => nil) }
50
50
  scope :invitation_accepted, lambda { where(arel_table[:invitation_accepted_at].not_eq(nil)) }
51
51
 
52
52
  [:before_invitation_accepted, :after_invitation_accepted].each do |callback_method|
@@ -124,7 +124,7 @@ module Devise
124
124
 
125
125
  # Required to workaround confirmable model's confirmation_required? method
126
126
  # being implemented to check for non-nil value of confirmed_at
127
- if self.new_record? && self.respond_to?(:confirmation_required?)
127
+ if self.new_record? && self.respond_to?(:confirmation_required?, true)
128
128
  def self.confirmation_required?; false; end
129
129
  end
130
130
 
@@ -133,8 +133,8 @@ module Devise
133
133
  self.invited_by = invited_by if invited_by
134
134
 
135
135
  # Call these before_validate methods since we aren't validating on save
136
- self.downcase_keys if self.new_record? && self.respond_to?(:downcase_keys)
137
- self.strip_whitespace if self.new_record? && self.respond_to?(:strip_whitespace)
136
+ self.downcase_keys if self.new_record? && self.respond_to?(:downcase_keys, true)
137
+ self.strip_whitespace if self.new_record? && self.respond_to?(:strip_whitespace, true)
138
138
 
139
139
  if save(:validate => false)
140
140
  self.invited_by.decrement_invitation_limit! if !was_invited and self.invited_by.present?
@@ -173,7 +173,7 @@ module Devise
173
173
  end
174
174
 
175
175
  def confirmation_required_for_invited?
176
- respond_to?(:confirmation_required?) && confirmation_required? && invitation_accepted?
176
+ respond_to?(:confirmation_required?, true) && confirmation_required? && invitation_accepted?
177
177
  end
178
178
 
179
179
  # Deliver the invitation email
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '1.1.7'
2
+ VERSION = '1.1.8'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_invitable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 7
10
- version: 1.1.7
9
+ - 8
10
+ version: 1.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sergio Cambra
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-04-01 00:00:00 Z
18
+ date: 2013-05-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -34,23 +34,22 @@ dependencies:
34
34
  type: :development
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: devise
37
+ name: railties
38
38
  prerelease: false
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
- - - ">="
42
+ - - ~>
43
43
  - !ruby/object:Gem::Version
44
- hash: 15
44
+ hash: 7
45
45
  segments:
46
- - 2
47
- - 1
48
- - 2
49
- version: 2.1.2
46
+ - 3
47
+ - 0
48
+ version: "3.0"
50
49
  type: :runtime
51
50
  version_requirements: *id002
52
51
  - !ruby/object:Gem::Dependency
53
- name: railties
52
+ name: actionmailer
54
53
  prerelease: false
55
54
  requirement: &id003 !ruby/object:Gem::Requirement
56
55
  none: false
@@ -65,18 +64,19 @@ dependencies:
65
64
  type: :runtime
66
65
  version_requirements: *id003
67
66
  - !ruby/object:Gem::Dependency
68
- name: actionmailer
67
+ name: devise
69
68
  prerelease: false
70
69
  requirement: &id004 !ruby/object:Gem::Requirement
71
70
  none: false
72
71
  requirements:
73
- - - ~>
72
+ - - ">="
74
73
  - !ruby/object:Gem::Version
75
- hash: 7
74
+ hash: 15
76
75
  segments:
77
- - 3
78
- - 0
79
- version: "3.0"
76
+ - 2
77
+ - 1
78
+ - 2
79
+ version: 2.1.2
80
80
  type: :runtime
81
81
  version_requirements: *id004
82
82
  description: It adds support for send invitations by email (it requires to be authenticated) and accept the invitation by setting a password.