invitation 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +18 -6
- data/app/controllers/invitation/invites_controller.rb +1 -1
- data/app/models/invite.rb +7 -0
- data/lib/invitation/configuration.rb +9 -0
- data/lib/invitation/version.rb +1 -1
- metadata +71 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 023e95a8f171a5147aca0e49f2176f6be31295e2
|
4
|
+
data.tar.gz: be5c790aac760b06b7842ce406b3179a1905fb6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 628a17cc7eb5c1dafcba5bd5bc603e953da193d8d40fccb1ea3fad51db02ffdffe810cfe892c4f7684fc1a19f4b846e6cc59b53beeefcfaebfbe1a632e9087f2
|
7
|
+
data.tar.gz: 5d9908ec3acd1b6fdbc9d351539d8ed683a541d5d7cabc9ef76400258c363b7e2f0bd38940798082b17e568f474c581989b0534afa8d8184aba37c69afc2b54e
|
data/Rakefile
CHANGED
@@ -1,15 +1,27 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
begin
|
3
|
-
|
4
|
-
rescue LoadError
|
5
|
-
|
6
|
-
end
|
2
|
+
# begin
|
3
|
+
# require 'bundler/setup'
|
4
|
+
# rescue LoadError
|
5
|
+
# puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
# end
|
7
|
+
|
8
|
+
require 'bundler/setup'
|
9
|
+
require 'bundler/gem_tasks'
|
10
|
+
require 'appraisal'
|
7
11
|
|
8
|
-
Bundler::GemHelper.install_tasks
|
12
|
+
# Bundler::GemHelper.install_tasks
|
9
13
|
|
10
14
|
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
11
15
|
load 'rails/tasks/engine.rake'
|
12
16
|
require 'rspec/core/rake_task'
|
13
17
|
|
18
|
+
namespace :dummy do
|
19
|
+
require_relative "spec/dummy/config/application"
|
20
|
+
Dummy::Application.load_tasks
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec::Core::RakeTask.new(:spec)
|
24
|
+
|
14
25
|
desc 'Run all specs in spec directory (excluding plugin specs)'
|
15
26
|
task default: :spec
|
27
|
+
|
@@ -25,7 +25,7 @@ class Invitation::InvitesController < ApplicationController
|
|
25
25
|
ActiveRecord::Base.transaction do
|
26
26
|
invites.each { |invite| invite.save ? do_invite(invite) : failures << invite.email }
|
27
27
|
end
|
28
|
-
|
28
|
+
logger.info "!!!!!!!!!!!!!!!!!!!!! INSIDE CREATE: current_user: #{current_user.inspect}"
|
29
29
|
respond_to do |format|
|
30
30
|
format.html do
|
31
31
|
if failures.empty?
|
data/app/models/invite.rb
CHANGED
@@ -8,6 +8,7 @@ class Invite < ActiveRecord::Base
|
|
8
8
|
belongs_to :recipient, class_name: Invitation.configuration.user_model_class_name
|
9
9
|
|
10
10
|
before_create :generate_token
|
11
|
+
before_save :set_email_case, on: :create
|
11
12
|
before_save :check_recipient_existence
|
12
13
|
|
13
14
|
validates :email, presence: true
|
@@ -26,4 +27,10 @@ class Invite < ActiveRecord::Base
|
|
26
27
|
recipient = Invitation.configuration.user_model.find_by_email(email)
|
27
28
|
self.recipient_id = recipient.id if recipient
|
28
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def set_email_case
|
34
|
+
email.downcase! unless Invitation.configuration.case_sensitive_email
|
35
|
+
end
|
29
36
|
end
|
@@ -45,11 +45,20 @@ module Invitation
|
|
45
45
|
# @return [Boolean]
|
46
46
|
attr_accessor :routes
|
47
47
|
|
48
|
+
# Enable or disable email case-sensivity when inviting users.
|
49
|
+
# If set to 'false', searching for user existence via email will disregard case.
|
50
|
+
#
|
51
|
+
# Defaults to 'true'.
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
attr_accessor :case_sensitive_email
|
55
|
+
|
48
56
|
def initialize
|
49
57
|
@user_model = ::User if defined?(::User)
|
50
58
|
@user_registration_url = ->(params) { Rails.application.routes.url_helpers.sign_up_url(params) }
|
51
59
|
@mailer_sender = 'reply@example.com'
|
52
60
|
@routes = true
|
61
|
+
@case_sensitive_email = true
|
53
62
|
end
|
54
63
|
|
55
64
|
def user_model_class_name
|
data/lib/invitation/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invitation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Tomich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,42 +36,42 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '4.
|
39
|
+
version: '4.8'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '4.
|
46
|
+
version: '4.8'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec-rails
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '3.
|
53
|
+
version: '3.5'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '3.
|
60
|
+
version: '3.5'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec-mocks
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '3.
|
67
|
+
version: '3.5'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '3.
|
74
|
+
version: '3.5'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: pry
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,72 +90,114 @@ dependencies:
|
|
90
90
|
name: sqlite3
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
95
|
+
version: '0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
102
|
+
version: '0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: shoulda-matchers
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
109
|
+
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- - "
|
114
|
+
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
116
|
+
version: '0'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: capybara
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - ">="
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
123
|
+
version: '0'
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - "
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
130
|
+
version: '0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: database_cleaner
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- - "
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- - "
|
142
|
+
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: timecop
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- - "
|
149
|
+
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: '0
|
151
|
+
version: '0'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
|
-
- - "
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: appraisal
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: bundler
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: rake
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
157
199
|
- !ruby/object:Gem::Version
|
158
|
-
version: '0
|
200
|
+
version: '0'
|
159
201
|
description: Allow users to invite other users to join your organization
|
160
202
|
email:
|
161
203
|
- justin@tomich.org
|
@@ -214,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
256
|
version: '0'
|
215
257
|
requirements: []
|
216
258
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.5.
|
259
|
+
rubygems_version: 2.5.2
|
218
260
|
signing_key:
|
219
261
|
specification_version: 4
|
220
262
|
summary: Allow users to invite other users to join your organization
|