devise_invitable 1.1.8 → 1.3.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.
Files changed (70) hide show
  1. data/CHANGELOG +5 -0
  2. data/README.rdoc +39 -12
  3. data/app/controllers/devise/invitations_controller.rb +20 -6
  4. data/app/controllers/devise_invitable/registrations_controller.rb +2 -2
  5. data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
  6. data/lib/devise_invitable/mailer.rb +3 -7
  7. data/lib/devise_invitable/model.rb +53 -59
  8. data/lib/devise_invitable/parameter_sanitizer.rb +11 -0
  9. data/lib/devise_invitable/rails.rb +1 -0
  10. data/lib/devise_invitable/version.rb +1 -1
  11. data/lib/devise_invitable.rb +1 -0
  12. data/lib/generators/active_record/templates/migration.rb +3 -2
  13. data/test/functional/controller_helpers_test.rb +39 -0
  14. data/test/functional/registrations_controller_test.rb +59 -0
  15. data/test/generators/views_generator_test.rb +40 -0
  16. data/test/generators_test.rb +34 -0
  17. data/test/integration/invitation_remove_test.rb +29 -0
  18. data/test/integration/invitation_test.rb +222 -0
  19. data/test/integration_tests_helper.rb +48 -0
  20. data/test/mailers/invitation_mail_test.rb +69 -0
  21. data/test/model_tests_helper.rb +33 -0
  22. data/test/models/invitable_test.rb +558 -0
  23. data/test/models_test.rb +74 -0
  24. data/test/orm/active_record.rb +4 -0
  25. data/test/orm/mongoid.rb +20 -0
  26. data/test/rails_app/Rakefile +7 -0
  27. data/test/rails_app/app/controllers/admins_controller.rb +6 -0
  28. data/test/rails_app/app/controllers/application_controller.rb +10 -0
  29. data/test/rails_app/app/controllers/free_invitations_controller.rb +6 -0
  30. data/test/rails_app/app/controllers/home_controller.rb +4 -0
  31. data/test/rails_app/app/controllers/users_controller.rb +12 -0
  32. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  33. data/test/rails_app/app/models/admin.rb +23 -0
  34. data/test/rails_app/app/models/octopussy.rb +15 -0
  35. data/test/rails_app/app/models/user.rb +56 -0
  36. data/test/rails_app/app/views/admins/new.html.erb +12 -0
  37. data/test/rails_app/app/views/free_invitations/new.html.erb +12 -0
  38. data/test/rails_app/app/views/home/index.html.erb +0 -0
  39. data/test/rails_app/app/views/layouts/application.html.erb +16 -0
  40. data/test/rails_app/app/views/users/invitations/new.html.erb +15 -0
  41. data/test/rails_app/config/application.rb +24 -0
  42. data/test/rails_app/config/boot.rb +11 -0
  43. data/test/rails_app/config/database.yml +22 -0
  44. data/test/rails_app/config/environment.rb +5 -0
  45. data/test/rails_app/config/environments/development.rb +25 -0
  46. data/test/rails_app/config/environments/production.rb +49 -0
  47. data/test/rails_app/config/environments/test.rb +33 -0
  48. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/rails_app/config/initializers/devise.rb +213 -0
  50. data/test/rails_app/config/initializers/inflections.rb +10 -0
  51. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  52. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  53. data/test/rails_app/config/initializers/session_store.rb +8 -0
  54. data/test/rails_app/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/rails_app/config/locales/devise.en.yml +57 -0
  56. data/test/rails_app/config/locales/en.yml +14 -0
  57. data/test/rails_app/config/routes.rb +9 -0
  58. data/test/rails_app/config.ru +4 -0
  59. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +39 -0
  60. data/test/rails_app/mongoid.yml +10 -0
  61. data/test/rails_app/script/rails +6 -0
  62. data/test/routes_test.rb +20 -0
  63. data/test/test_helper.rb +24 -0
  64. metadata +135 -47
  65. data/app/controllers/devise_invitable/registrations_controller.rb~ +0 -15
  66. data/lib/devise_invitable/controllers/helpers.rb~ +0 -21
  67. data/lib/devise_invitable/controllers/registrations.rb~ +0 -21
  68. data/lib/devise_invitable/model.rb~ +0 -224
  69. data/lib/devise_invitable/rails.rb~ +0 -21
  70. data/lib/devise_invitable.rb~ +0 -65
@@ -0,0 +1,57 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ errors:
5
+ messages:
6
+ expired: "has expired, please request a new one"
7
+ not_found: "not found"
8
+ already_confirmed: "was already confirmed, please try signing in"
9
+ not_locked: "was not locked"
10
+ not_saved:
11
+ one: "1 error prohibited this %{resource} from being saved:"
12
+ other: "%{count} errors prohibited this %{resource} from being saved:"
13
+
14
+ devise:
15
+ failure:
16
+ already_authenticated: 'You are already signed in.'
17
+ unauthenticated: 'You need to sign in or sign up before continuing.'
18
+ unconfirmed: 'You have to confirm your account before continuing.'
19
+ locked: 'Your account is locked.'
20
+ invalid: 'Invalid email or password.'
21
+ invalid_token: 'Invalid authentication token.'
22
+ timeout: 'Your session expired, please sign in again to continue.'
23
+ inactive: 'Your account was not activated yet.'
24
+ sessions:
25
+ signed_in: 'Signed in successfully.'
26
+ signed_out: 'Signed out successfully.'
27
+ passwords:
28
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
+ updated: 'Your password was changed successfully. You are now signed in.'
30
+ updated_not_active: 'Your password was changed successfully.'
31
+ send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
32
+ confirmations:
33
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
+ send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
36
+ registrations:
37
+ signed_up: 'Welcome! You have signed up successfully.'
38
+ signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
39
+ signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
40
+ signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
41
+ updated: 'You updated your account successfully.'
42
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
43
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44
+ unlocks:
45
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
46
+ unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
47
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
48
+ omniauth_callbacks:
49
+ success: 'Successfully authorized from %{kind} account.'
50
+ failure: 'Could not authorize you from %{kind} because "%{reason}".'
51
+ mailer:
52
+ confirmation_instructions:
53
+ subject: 'Confirmation instructions'
54
+ reset_password_instructions:
55
+ subject: 'Reset password instructions'
56
+ unlock_instructions:
57
+ subject: 'Unlock Instructions'
@@ -0,0 +1,14 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
6
+ devise:
7
+ free_invitations:
8
+ send_instructions: 'An invitation email has been sent to %{email}.'
9
+ admins:
10
+ send_instructions: 'An invitation email has been sent to %{email}.'
11
+ mongoid:
12
+ errors:
13
+ messages:
14
+ taken: "has already been taken"
@@ -0,0 +1,9 @@
1
+ RailsApp::Application.routes.draw do
2
+ devise_for :users
3
+ devise_scope :user do
4
+ resource :free_invitation, :only => [:new, :create]
5
+ resource :admin, :only => [:new, :create]
6
+ end
7
+ devise_for :admins
8
+ root :to => 'home#index'
9
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run TestApp::Application
@@ -0,0 +1,39 @@
1
+ class CreateTables < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ ## Database authenticatable
5
+ t.string :email, :null => true, :default => ""
6
+ t.string :encrypted_password, :null => true, :default => ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Confirmable
13
+ t.string :confirmation_token
14
+ t.datetime :confirmed_at
15
+ t.datetime :confirmation_sent_at
16
+ t.string :unconfirmed_email # Only if using reconfirmable
17
+
18
+ t.string :username
19
+
20
+ ## Invitable
21
+ t.string :invitation_token, :limit => 60
22
+ t.datetime :invitation_created_at
23
+ t.datetime :invitation_sent_at
24
+ t.datetime :invitation_accepted_at
25
+ t.integer :invitation_limit
26
+ t.integer :invited_by_id
27
+ t.string :invited_by_type
28
+
29
+ t.timestamps
30
+ end
31
+ add_index :users, :invitation_token, :unique => true
32
+
33
+ create_table :admins do |t|
34
+ ## Database authenticatable
35
+ t.string :email, :null => true, :default => ""
36
+ t.string :encrypted_password, :null => true, :default => ""
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,10 @@
1
+ defaults: &defaults
2
+ host: localhost
3
+ allow_dynamic_fields: true
4
+ parameterize_keys: true
5
+ persist_in_safe_mode: true
6
+ raise_not_found_error: true
7
+
8
+ test:
9
+ <<: *defaults
10
+ database: devise_invitable-test-suite
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,20 @@
1
+ require 'test_helper'
2
+
3
+ class RoutesTest < ActionController::TestCase
4
+
5
+ test 'map new user invitation' do
6
+ assert_recognizes({:controller => 'devise/invitations', :action => 'new'}, {:path => 'users/invitation/new', :method => :get})
7
+ end
8
+
9
+ test 'map create user invitation' do
10
+ assert_recognizes({:controller => 'devise/invitations', :action => 'create'}, {:path => 'users/invitation', :method => :post})
11
+ end
12
+
13
+ test 'map accept user invitation' do
14
+ assert_recognizes({:controller => 'devise/invitations', :action => 'edit'}, 'users/invitation/accept')
15
+ end
16
+
17
+ test 'map update user invitation' do
18
+ assert_recognizes({:controller => 'devise/invitations', :action => 'update'}, {:path => 'users/invitation', :method => :put})
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
+
4
+ $:.unshift File.dirname(__FILE__)
5
+ puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}"
6
+ require "rails_app/config/environment"
7
+ include Devise::TestHelpers
8
+ require "orm/#{DEVISE_ORM}"
9
+ require 'rails/test_help'
10
+ require 'capybara/rails'
11
+ require 'mocha/setup'
12
+
13
+ ActionMailer::Base.delivery_method = :test
14
+ ActionMailer::Base.perform_deliveries = true
15
+ ActionMailer::Base.default_url_options[:host] = 'test.com'
16
+
17
+ ActiveSupport::Deprecation.silenced = true
18
+
19
+ class ActionDispatch::IntegrationTest
20
+ include Capybara::DSL
21
+ end
22
+ class ActionController::TestCase
23
+ include Devise::TestHelpers
24
+ 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: 3
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
9
- - 8
10
- version: 1.1.8
8
+ - 3
9
+ - 0
10
+ version: 1.3.0
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-05-02 00:00:00 Z
18
+ date: 2013-10-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -34,51 +34,43 @@ dependencies:
34
34
  type: :development
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: railties
37
+ name: actionmailer
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: 7
44
+ hash: 3
45
45
  segments:
46
46
  - 3
47
- - 0
48
- version: "3.0"
49
- type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: actionmailer
53
- prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ~>
47
+ - 2
48
+ - 6
49
+ version: 3.2.6
50
+ - - <
58
51
  - !ruby/object:Gem::Version
59
- hash: 7
52
+ hash: 9
60
53
  segments:
61
- - 3
62
- - 0
63
- version: "3.0"
54
+ - 5
55
+ version: "5"
64
56
  type: :runtime
65
- version_requirements: *id003
57
+ version_requirements: *id002
66
58
  - !ruby/object:Gem::Dependency
67
59
  name: devise
68
60
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
61
+ requirement: &id003 !ruby/object:Gem::Requirement
70
62
  none: false
71
63
  requirements:
72
64
  - - ">="
73
65
  - !ruby/object:Gem::Version
74
- hash: 15
66
+ hash: 3
75
67
  segments:
76
- - 2
68
+ - 3
77
69
  - 1
78
- - 2
79
- version: 2.1.2
70
+ - 0
71
+ version: 3.1.0
80
72
  type: :runtime
81
- version_requirements: *id004
73
+ version_requirements: *id003
82
74
  description: It adds support for send invitations by email (it requires to be authenticated) and accept the invitation by setting a password.
83
75
  email:
84
76
  - sergio@entrecables.com
@@ -91,39 +83,86 @@ extra_rdoc_files: []
91
83
  files:
92
84
  - app/controllers/devise/invitations_controller.rb
93
85
  - app/controllers/devise_invitable/registrations_controller.rb
94
- - app/controllers/devise_invitable/registrations_controller.rb~
95
86
  - app/views/devise/invitations/edit.html.erb
96
87
  - app/views/devise/invitations/new.html.erb
97
88
  - app/views/devise/mailer/invitation_instructions.html.erb
98
89
  - config/locales/en.yml
99
90
  - lib/devise_invitable.rb
91
+ - lib/devise_invitable/controllers/helpers.rb
92
+ - lib/devise_invitable/controllers/url_helpers.rb
93
+ - lib/devise_invitable/inviter.rb
100
94
  - lib/devise_invitable/mailer.rb
95
+ - lib/devise_invitable/mapping.rb
101
96
  - lib/devise_invitable/model.rb
97
+ - lib/devise_invitable/parameter_sanitizer.rb
102
98
  - lib/devise_invitable/rails.rb
103
99
  - lib/devise_invitable/routes.rb
104
100
  - lib/devise_invitable/version.rb
105
- - lib/devise_invitable/controllers/helpers.rb
106
- - lib/devise_invitable/controllers/url_helpers.rb
107
- - lib/devise_invitable/controllers/registrations.rb~
108
- - lib/devise_invitable/controllers/helpers.rb~
109
- - lib/devise_invitable/rails.rb~
110
- - lib/devise_invitable/inviter.rb
111
- - lib/devise_invitable/mapping.rb
112
- - lib/devise_invitable/model.rb~
113
101
  - lib/generators/active_record/devise_invitable_generator.rb
114
102
  - lib/generators/active_record/templates/migration.rb
115
- - lib/generators/devise_invitable/views_generator.rb
116
103
  - lib/generators/devise_invitable/devise_invitable_generator.rb
117
104
  - lib/generators/devise_invitable/install_generator.rb
118
105
  - lib/generators/devise_invitable/templates/simple_form_for/invitations/edit.html.erb
119
106
  - lib/generators/devise_invitable/templates/simple_form_for/invitations/new.html.erb
107
+ - lib/generators/devise_invitable/views_generator.rb
120
108
  - lib/generators/mongoid/devise_invitable_generator.rb
121
- - lib/devise_invitable.rb~
122
109
  - LICENSE
123
110
  - README.rdoc
111
+ - CHANGELOG
112
+ - test/functional/controller_helpers_test.rb
113
+ - test/functional/registrations_controller_test.rb
114
+ - test/generators/views_generator_test.rb
115
+ - test/generators_test.rb
116
+ - test/integration/invitation_remove_test.rb
117
+ - test/integration/invitation_test.rb
118
+ - test/integration_tests_helper.rb
119
+ - test/mailers/invitation_mail_test.rb
120
+ - test/model_tests_helper.rb
121
+ - test/models/invitable_test.rb
122
+ - test/models_test.rb
123
+ - test/orm/active_record.rb
124
+ - test/orm/mongoid.rb
125
+ - test/rails_app/Rakefile
126
+ - test/rails_app/app/controllers/admins_controller.rb
127
+ - test/rails_app/app/controllers/application_controller.rb
128
+ - test/rails_app/app/controllers/free_invitations_controller.rb
129
+ - test/rails_app/app/controllers/home_controller.rb
130
+ - test/rails_app/app/controllers/users_controller.rb
131
+ - test/rails_app/app/helpers/application_helper.rb
132
+ - test/rails_app/app/models/admin.rb
133
+ - test/rails_app/app/models/octopussy.rb
134
+ - test/rails_app/app/models/user.rb
135
+ - test/rails_app/app/views/admins/new.html.erb
136
+ - test/rails_app/app/views/free_invitations/new.html.erb
137
+ - test/rails_app/app/views/home/index.html.erb
138
+ - test/rails_app/app/views/layouts/application.html.erb
139
+ - test/rails_app/app/views/users/invitations/new.html.erb
140
+ - test/rails_app/config.ru
141
+ - test/rails_app/config/application.rb
142
+ - test/rails_app/config/boot.rb
143
+ - test/rails_app/config/database.yml
144
+ - test/rails_app/config/environment.rb
145
+ - test/rails_app/config/environments/development.rb
146
+ - test/rails_app/config/environments/production.rb
147
+ - test/rails_app/config/environments/test.rb
148
+ - test/rails_app/config/initializers/backtrace_silencers.rb
149
+ - test/rails_app/config/initializers/devise.rb
150
+ - test/rails_app/config/initializers/inflections.rb
151
+ - test/rails_app/config/initializers/mime_types.rb
152
+ - test/rails_app/config/initializers/secret_token.rb
153
+ - test/rails_app/config/initializers/session_store.rb
154
+ - test/rails_app/config/initializers/wrap_parameters.rb
155
+ - test/rails_app/config/locales/devise.en.yml
156
+ - test/rails_app/config/locales/en.yml
157
+ - test/rails_app/config/routes.rb
158
+ - test/rails_app/db/migrate/20100401102949_create_tables.rb
159
+ - test/rails_app/mongoid.yml
160
+ - test/rails_app/script/rails
161
+ - test/routes_test.rb
162
+ - test/test_helper.rb
124
163
  homepage: https://github.com/scambra/devise_invitable
125
- licenses: []
126
-
164
+ licenses:
165
+ - MIT
127
166
  post_install_message:
128
167
  rdoc_options:
129
168
  - --main
@@ -156,10 +195,59 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
195
  requirements: []
157
196
 
158
197
  rubyforge_project:
159
- rubygems_version: 1.8.23
198
+ rubygems_version: 1.8.24
160
199
  signing_key:
161
200
  specification_version: 3
162
201
  summary: An invitation strategy for Devise
163
- test_files: []
164
-
165
- has_rdoc:
202
+ test_files:
203
+ - test/functional/controller_helpers_test.rb
204
+ - test/functional/registrations_controller_test.rb
205
+ - test/generators/views_generator_test.rb
206
+ - test/generators_test.rb
207
+ - test/integration/invitation_remove_test.rb
208
+ - test/integration/invitation_test.rb
209
+ - test/integration_tests_helper.rb
210
+ - test/mailers/invitation_mail_test.rb
211
+ - test/model_tests_helper.rb
212
+ - test/models/invitable_test.rb
213
+ - test/models_test.rb
214
+ - test/orm/active_record.rb
215
+ - test/orm/mongoid.rb
216
+ - test/rails_app/Rakefile
217
+ - test/rails_app/app/controllers/admins_controller.rb
218
+ - test/rails_app/app/controllers/application_controller.rb
219
+ - test/rails_app/app/controllers/free_invitations_controller.rb
220
+ - test/rails_app/app/controllers/home_controller.rb
221
+ - test/rails_app/app/controllers/users_controller.rb
222
+ - test/rails_app/app/helpers/application_helper.rb
223
+ - test/rails_app/app/models/admin.rb
224
+ - test/rails_app/app/models/octopussy.rb
225
+ - test/rails_app/app/models/user.rb
226
+ - test/rails_app/app/views/admins/new.html.erb
227
+ - test/rails_app/app/views/free_invitations/new.html.erb
228
+ - test/rails_app/app/views/home/index.html.erb
229
+ - test/rails_app/app/views/layouts/application.html.erb
230
+ - test/rails_app/app/views/users/invitations/new.html.erb
231
+ - test/rails_app/config.ru
232
+ - test/rails_app/config/application.rb
233
+ - test/rails_app/config/boot.rb
234
+ - test/rails_app/config/database.yml
235
+ - test/rails_app/config/environment.rb
236
+ - test/rails_app/config/environments/development.rb
237
+ - test/rails_app/config/environments/production.rb
238
+ - test/rails_app/config/environments/test.rb
239
+ - test/rails_app/config/initializers/backtrace_silencers.rb
240
+ - test/rails_app/config/initializers/devise.rb
241
+ - test/rails_app/config/initializers/inflections.rb
242
+ - test/rails_app/config/initializers/mime_types.rb
243
+ - test/rails_app/config/initializers/secret_token.rb
244
+ - test/rails_app/config/initializers/session_store.rb
245
+ - test/rails_app/config/initializers/wrap_parameters.rb
246
+ - test/rails_app/config/locales/devise.en.yml
247
+ - test/rails_app/config/locales/en.yml
248
+ - test/rails_app/config/routes.rb
249
+ - test/rails_app/db/migrate/20100401102949_create_tables.rb
250
+ - test/rails_app/mongoid.yml
251
+ - test/rails_app/script/rails
252
+ - test/routes_test.rb
253
+ - test/test_helper.rb
@@ -1,15 +0,0 @@
1
- class DeviseInvitable::RegistrationsController < Devise::RegistrationsController
2
- protected
3
-
4
- def build_resource(*args)
5
- hash = args.pop || resource_params || {}
6
- if hash[:email]
7
- self.resource = resource_class.where(:email => hash[:email], :encrypted_password => '').first
8
- if self.resource
9
- self.resource.attributes = hash
10
- self.resource.accept_invitation!
11
- end
12
- end
13
- self.resource ||= super(hash, *args)
14
- end
15
- end
@@ -1,21 +0,0 @@
1
- module DeviseInvitable::Controllers::Helpers
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- hide_action :after_invite_path_for, :after_accept_path_for
6
- end
7
-
8
- def after_invite_path_for(resource)
9
- after_sign_in_path_for(resource)
10
- end
11
-
12
- def after_accept_path_for(resource)
13
- after_sign_in_path_for(resource)
14
- end
15
-
16
- protected
17
- def authenticate_inviter!
18
- send(:"authenticate_#{resource_name}!", :force => true)
19
- end
20
-
21
- end
@@ -1,21 +0,0 @@
1
- module DeviseInvitable::Controllers::Registrations
2
- def self.included(controller)
3
- controller.alias_method_chain :build_resource, :invitation
4
- end
5
-
6
- protected
7
-
8
- def build_resource_with_invitation(*args)
9
- hash = args.pop || resource_params || {}
10
- if hash[:email]
11
- self.resource = resource_class.where(:email => hash[:email], :encrypted_password => '').first
12
- if self.resource
13
- puts self.resource.inspect
14
- self.resource.attributes = hash
15
- self.resource.accept_invitation!
16
- puts self.resource.inspect
17
- end
18
- end
19
- self.resource ||= build_resource_without_invitation(hash, *args)
20
- end
21
- end