devise_invitable 2.0.0 → 2.0.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.

Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/README.rdoc +88 -37
  4. data/app/controllers/devise/invitations_controller.rb +33 -32
  5. data/app/controllers/devise_invitable/registrations_controller.rb +11 -11
  6. data/app/views/devise/invitations/edit.html.erb +1 -1
  7. data/app/views/devise/mailer/invitation_instructions.html.erb +1 -1
  8. data/app/views/devise/mailer/invitation_instructions.text.erb +1 -1
  9. data/config/locales/ar.yml +23 -0
  10. data/config/locales/ca.yml +32 -0
  11. data/config/locales/da.yml +41 -0
  12. data/config/locales/de.yml +31 -0
  13. data/config/locales/es.yml +31 -0
  14. data/config/locales/et.yml +23 -0
  15. data/config/locales/fa.yml +31 -0
  16. data/config/locales/fr.yml +34 -0
  17. data/config/locales/it.yml +31 -0
  18. data/config/locales/ja.yml +31 -0
  19. data/config/locales/ko.yml +24 -0
  20. data/config/locales/nl.yml +32 -0
  21. data/config/locales/no.yml +17 -0
  22. data/config/locales/pl.yml +31 -0
  23. data/config/locales/pt-BR.yml +23 -0
  24. data/config/locales/pt.yml +23 -0
  25. data/config/locales/ru.yml +23 -0
  26. data/config/locales/tr.yml +24 -0
  27. data/config/locales/ua.yml +31 -0
  28. data/config/locales/vi.yml +25 -0
  29. data/config/locales/zh-HK.yml +31 -0
  30. data/config/locales/zh-TW.yml +31 -0
  31. data/lib/devise_invitable/controllers/helpers.rb +7 -4
  32. data/lib/devise_invitable/inviter.rb +4 -3
  33. data/lib/devise_invitable/mapping.rb +8 -5
  34. data/lib/devise_invitable/models/authenticatable.rb +7 -1
  35. data/lib/devise_invitable/models.rb +16 -13
  36. data/lib/devise_invitable/parameter_sanitizer.rb +18 -18
  37. data/lib/devise_invitable/routes.rb +1 -1
  38. data/lib/devise_invitable/version.rb +1 -1
  39. data/lib/devise_invitable.rb +2 -1
  40. data/lib/generators/active_record/templates/migration.rb +0 -1
  41. data/lib/generators/devise_invitable/devise_invitable_generator.rb +1 -1
  42. data/lib/generators/devise_invitable/install_generator.rb +4 -3
  43. data/test/functional/controller_helpers_test.rb +10 -0
  44. data/test/generators/views_generator_test.rb +7 -6
  45. data/test/generators_test.rb +3 -2
  46. data/test/integration/invitation_test.rb +1 -1
  47. data/test/integration_tests_helper.rb +0 -1
  48. data/test/mailers/invitation_mail_test.rb +1 -1
  49. data/test/model_tests_helper.rb +1 -1
  50. data/test/models/invitable_test.rb +27 -11
  51. data/test/orm/active_record.rb +6 -1
  52. data/test/rails_app/app/controllers/admins_controller.rb +4 -3
  53. data/test/rails_app/app/controllers/application_controller.rb +10 -9
  54. data/test/rails_app/app/controllers/free_invitations_controller.rb +12 -9
  55. data/test/rails_app/config/initializers/devise.rb +4 -3
  56. data/test/rails_app/config/initializers/secret_token.rb +9 -0
  57. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -2
  58. data/test/test_helper.rb +5 -18
  59. metadata +32 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2723ccf2ae328662f6728a699ac484ff5067dbb24248e59d7d596a9d445747ab
4
- data.tar.gz: 7d95b8d919685e863dbe8126ce5823b78f949c67f6ada3e69adab431d29e7711
3
+ metadata.gz: 1d79a9c9139872616687b6479929d53572f9634188eeb9a83a7fdb56c9a56de0
4
+ data.tar.gz: dd37eafdb0b8a074c11ab51c25b8faea114992cf640e599edb5b9fefec0eb9a3
5
5
  SHA512:
6
- metadata.gz: ba422fbe6c9b3d7d13dae30f24daf9638ace499ceead90f7d3d18949655028b33d53c5275000aafecd4a9b75595ad174d3348a4511a7dbe70957bd9a43cd5945
7
- data.tar.gz: b8eb68401a1fd5e41b861fbe8d8dd38b4f9050d87427d00cb5ea394630e5e5f5a16d6889da85199e597d8bdc2947aa8523208aca95fb731d39c50ba9f5d4a4d5
6
+ metadata.gz: a275438d6791f2f3e06d3d7a0b83db15142ce0a24337f928e08ee7c9818aa517efaa070c73e2bfc280a28ef8cf1104a9aa6711c8325479c02a794a1b963ec9d5
7
+ data.tar.gz: cef6663d0ce1f61b87dcc73cf151afa55a4054983c8a580d2a94446887f5018a5ba604eea0a656495e2ae3755bc437457c1d109d1ae8faf775182417c4ca313f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## 2.0.8
2
+ - Fix for turbo stream
3
+
4
+ ## 2.0.7
5
+ - Allow customizing invalid_token_path_for, the path to redirect users who try to accept with invalid token
6
+ - Don't override registrations controller in routes if module option is used
7
+ - Fix typo in spanish translation, add Catalan translation ([#857](https://github.com/scambra/devise_invitable/pull/857))
8
+ - Fix for ruby 3.2.0
9
+
10
+ ## 2.0.6
11
+ - Fix submit form failure with turbolinks, fixes ([#865](https://github.com/scambra/devise_invitable/issues/865))
12
+ - Fix obsolete symbols in German translation ([#864](https://github.com/scambra/devise_invitable/pull/864))
13
+ - Allow to provide validate option to the instance method "invite!", default to follow the setting validate_on_invite
14
+
15
+ ## 2.0.5
16
+ - Fix NoMethodError in random_password when validatable is not used ([#850](https://github.com/scambra/devise_invitable/pull/850))
17
+
18
+ ## 2.0.4
19
+ - Fix devise deprecations ([#842](https://github.com/scambra/devise_invitable/pull/842))
20
+ - Update translations ([#844](https://github.com/scambra/devise_invitable/pull/844), [#845](https://github.com/scambra/devise_invitable/pull/845))
21
+ - Fix/enforce initial password length to follow devise ([#848](https://github.com/scambra/devise_invitable/pull/848))
22
+
23
+ ## 2.0.3
24
+ - Add locales ([#834](https://github.com/scambra/devise_invitable/pull/834), [#835](https://github.com/scambra/devise_invitable/pull/835))
25
+ - Remove index on invitations_count column ([#830](https://github.com/scambra/devise_invitable/pull/830))
26
+
27
+ ## 2.0.2
28
+ - Fix ruby 2.7 deprecation warning
29
+
30
+ ## 2.0.1
31
+ - Use per-model allow_insecure_sign_in_after_accept ([#790](https://github.com/scambra/devise_invitable/pull/790))
32
+
1
33
  ## 2.0.0
2
34
  - Remove deprecated devise_error_messages! from templates ([#786](https://github.com/scambra/devise_invitable/pull/785))
3
35
  - Drop Devise < 4.6 support ([#786](https://github.com/scambra/devise_invitable/pull/786))
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = DeviseInvitable
2
- {<img src="https://badge.fury.io/rb/devise_invitable.svg"/>}[http://badge.fury.io/rb/devise_invitable] {<img src="https://travis-ci.org/scambra/devise_invitable.png"/>}[https://travis-ci.org/scambra/devise_invitable] {<img src="https://codeclimate.com/github/scambra/devise_invitable/badges/gpa.svg"/>}[https://codeclimate.com/github/scambra/devise_invitable]
2
+ {<img src="https://badge.fury.io/rb/devise_invitable.svg"/>}[http://badge.fury.io/rb/devise_invitable]
3
+ {<img src="https://github.com/scambra/devise_invitable/actions/workflows/ci.yml/badge.svg"/>}[https://github.com/scambra/devise_invitable/actions/workflows/ci.yml]
4
+ {<img src="https://codeclimate.com/github/scambra/devise_invitable/badges/gpa.svg"/>}[https://codeclimate.com/github/scambra/devise_invitable]
3
5
 
4
6
  It adds support to Devise[https://github.com/plataformatec/devise] for sending invitations by email (it requires to be authenticated) and accept the invitation setting the password.
5
7
 
@@ -35,14 +37,14 @@ Replace MODEL by the class name you want to add DeviseInvitable, like <tt>User</
35
37
 
36
38
  Follow the walkthrough for Devise and after it's done, follow this walkthrough.
37
39
 
38
- == Devise Configuration
40
+ ==== Devise Configuration
39
41
  Add <tt>:invitable</tt> to the <tt>devise</tt> call in your model (we’re assuming here you already have a User model with some Devise modules):
40
42
 
41
43
  class User < ActiveRecord::Base
42
44
  devise :database_authenticatable, :confirmable, :invitable
43
45
  end
44
46
 
45
- == ActiveRecord Migration
47
+ ==== ActiveRecord Migration
46
48
  Add <tt>t.invitable</tt> to your Devise model migration:
47
49
 
48
50
  create_table :users do
@@ -70,11 +72,6 @@ or for a model that already exists, define a migration to add DeviseInvitable to
70
72
  add_column :users, :invited_by_id, :integer
71
73
  add_column :users, :invited_by_type, :string
72
74
  add_index :users, :invitation_token, unique: true
73
-
74
- # Allow null encrypted_password
75
- change_column_null :users, :encrypted_password, :string, true
76
- # Allow null password_salt (add it if you are using Devise's encryptable module)
77
- change_column_null :users, :password_salt, :string, true
78
75
  end
79
76
 
80
77
  If you previously used devise_invitable with a <tt>:limit</tt> on <tt>:invitation_token</tt>, remove it:
@@ -109,13 +106,13 @@ Remember to create indexes within the MongoDB database after deploying your chan
109
106
 
110
107
  DeviseInvitable adds some new configuration options:
111
108
 
112
- * <tt>invite_for</tt>: The period the generated invitation token is valid, after this period, the invited resource won't be able to accept the invitation. When <tt>invite_for</tt> is <tt>0</tt> (the default), the invitation won't expire.
109
+ * <tt>invite_for</tt>: The period the generated invitation token is valid. After this period, the invited resource won't be able to accept the invitation. When <tt>invite_for</tt> is <tt>0</tt> (the default), the invitation won't expire.
113
110
 
114
111
  You can set this configuration option in the Devise initializer as follow:
115
112
 
116
113
  # ==> Configuration for :invitable
117
- # The period the generated invitation token is valid, after
118
- # this period, the invited resource won't be able to accept the invitation.
114
+ # The period the generated invitation token is valid.
115
+ # After this period, the invited resource won't be able to accept the invitation.
119
116
  # When invite_for is 0 (the default), the invitation won't expire.
120
117
  # config.invite_for = 2.weeks
121
118
 
@@ -186,23 +183,21 @@ To change behaviour of inviting or accepting users, you can simply override two
186
183
  class Users::InvitationsController < Devise::InvitationsController
187
184
  private
188
185
 
189
- # this is called when creating invitation
190
- # should return an instance of resource class
191
- def invite_resource
192
- ## skip sending emails on invite
193
- super do |u|
194
- u.skip_invitation = true
186
+ # This is called when creating invitation.
187
+ # It should return an instance of resource class.
188
+ def invite_resource
189
+ # skip sending emails on invite
190
+ super { |user| user.skip_invitation = true }
195
191
  end
196
- end
197
192
 
198
- # this is called when accepting invitation
199
- # should return an instance of resource class
200
- def accept_resource
201
- resource = resource_class.accept_invitation!(update_resource_params)
202
- ## Report accepting invitation to analytics
203
- Analytics.report('invite.accept', resource.id)
204
- resource
205
- end
193
+ # This is called when accepting invitation.
194
+ # It should return an instance of resource class.
195
+ def accept_resource
196
+ resource = resource_class.accept_invitation!(update_resource_params)
197
+ # Report accepting invitation to analytics
198
+ Analytics.report('invite.accept', resource.id)
199
+ resource
200
+ end
206
201
  end
207
202
 
208
203
  == Strong Parameters
@@ -224,6 +219,61 @@ Here is an example of what your application controller might need to include in
224
219
  devise_parameter_sanitizer.permit(:accept_invitation, keys: [:first_name, :last_name, :phone])
225
220
  end
226
221
 
222
+ Here is an example setting a User's first name, last name, and role for a custom invitation:
223
+
224
+ #Configuring the InvitationsController to accept :first_name, :last_name, and :role
225
+
226
+ class Users::InvitationsController < Devise::InvitationsController
227
+ before_action :configure_permitted_parameters
228
+
229
+ protected
230
+
231
+ # Permit the new params here.
232
+ def configure_permitted_parameters
233
+ devise_parameter_sanitizer.permit(:invite, keys: [:first_name, :last_name, :role])
234
+ end
235
+ end
236
+
237
+ #Define your roles in the User model
238
+
239
+ class User < ApplicationRecord
240
+ has_many :models
241
+
242
+ enum role: {Role 1 Name: 0, Role 2 Name: 1, Role 3 Name: 2, etc...}
243
+ end
244
+
245
+ #In the Invitation view
246
+
247
+ <h2><%= t "devise.invitations.new.header" %></h2>
248
+
249
+ <%= form_for(resource, as: resource_name, url: invitation_path(resource_name), html: { method: :post }) do |f| %>
250
+ <%= render "devise/shared/error_messages", resource: resource %>
251
+ <% resource.class.invite_key_fields.each do |field| -%>
252
+ <div class="field">
253
+ <%= f.label field %><br />
254
+ <%= f.text_field field %>
255
+ </div>
256
+ <% end %>
257
+
258
+ <div class="field">
259
+ <%= f.label :first_name %>
260
+ <%= f.text_field :first_name %>
261
+ </div>
262
+
263
+ <div class="field">
264
+ <%= f.label :last_name %>
265
+ <%= f.text_field :last_name %>
266
+ </div>
267
+
268
+ <div class="field">
269
+ <%= f.label :role %>
270
+ <%= f.select :role, options_for_select(User.roles.map { |key, value| [key.humanize, key] }), {prompt: "Select Role"} %>
271
+ </div>
272
+
273
+ <div class="actions">
274
+ <%= f.submit t("devise.invitations.new.submit_button") %>
275
+ </div>
276
+ <% end %>
227
277
 
228
278
  == Usage
229
279
 
@@ -241,13 +291,13 @@ If you want to create the invitation but not send it, you can set <tt>skip_invit
241
291
  end
242
292
  # => the record will be created, but the invitation email will not be sent
243
293
 
244
- When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt>
245
- the value is temporarily available when you invite a user and will be decrypted when recieved.
294
+ When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt>.
295
+ This value is temporarily available when you invite a user and will be decrypted when received.
246
296
 
247
297
  accept_user_invitation_url(invitation_token: user.raw_invitation_token)
248
298
 
249
299
  When <tt>skip_invitation</tt> is used, you must also then set the <tt>invitation_sent_at</tt> field when the user is sent their token. Failure to do so will yield "Invalid invitation token" error when the user attempts to accept the invite.
250
- You can set column, or call <tt>deliver_invitation</tt> to sent invitation and set column:
300
+ You can set the column, or call <tt>deliver_invitation</tt> to send the invitation and set the column:
251
301
 
252
302
  user.deliver_invitation
253
303
 
@@ -291,7 +341,7 @@ To accept an invitation with a token use the <tt>accept_invitation!</tt> class m
291
341
  === Callbacks
292
342
 
293
343
  A callback event is fired before and after an invitation is created (User#invite!) or accepted (User#accept_invitation!). For example, in your resource model you can add:
294
-
344
+ # Note: callbacks should be placed after devise: :invitable is specified.
295
345
  before_invitation_created :email_admins
296
346
  after_invitation_accepted :email_invited_by
297
347
 
@@ -315,16 +365,16 @@ A pair of scopes to find those users that have accepted, and those that have not
315
365
 
316
366
  == Integration in a Rails application
317
367
 
318
- Since the invitations controller take care of all the creation/acceptation of an invitation, in most cases you wouldn't call the <tt>invite!</tt> and <tt>accept_invitation!</tt> methods directly.
368
+ Since the invitations controller takes care of all the creation/acceptation of an invitation, in most cases you wouldn't call the <tt>invite!</tt> and <tt>accept_invitation!</tt> methods directly.
319
369
  Instead, in your views, put a link to <tt>new_user_invitation_path</tt> or <tt>new_invitation_path(:user)</tt> or even <tt>/users/invitation/new</tt> to prepare and send an invitation (to a user in this example).
320
370
 
321
371
  After an invitation is created and sent, the inviter will be redirected to <tt>after_invite_path_for(inviter, invitee)</tt>, which is the same path as <tt>signed_in_root_path</tt> by default.
322
372
 
323
373
  After an invitation is accepted, the invitee will be redirected to <tt>after_accept_path_for(resource)</tt>, which is the same path as <tt>signed_in_root_path</tt> by default. If you want to override the path, override invitations controller and define <tt>after_accept_path_for</tt> method. This is useful in the common case that a user is invited to a specific location in your application. More on {Devise's README}[https://github.com/plataformatec/devise], "Controller filters and helpers" section.
324
374
 
325
- The invitation email includes a link to accept the invitation that looks like this: <tt>/users/invitation/accept?invitation_token=abcd123</tt>. When clicked, the invited must set a password in order to accept its invitation. Note that if the <tt>invitation_token</tt> is not present or not valid, the invited is redirected to <tt>after_sign_out_path_for(resource_name)</tt>.
375
+ The invitation email includes a link to accept the invitation that looks like this: <tt>/users/invitation/accept?invitation_token=abcd123</tt>. When clicked, the invited must set a password in order to accept its invitation. Note that if the <tt>invitation_token</tt> is not present or not valid, the invited is redirected to <tt>invalid_token_path_for(resource_name)</tt>, which by default is <tt>after_sign_out_path_for(resource_name)</tt>.
326
376
 
327
- The controller sets the <tt>invited_by_id</tt> attribute for the new user to the current user. This will let you easily keep track of who invited who.
377
+ The controller sets the <tt>invited_by_id</tt> attribute for the new user to the current user. This will let you easily keep track of who invited whom.
328
378
 
329
379
  == Controller filter
330
380
 
@@ -335,10 +385,11 @@ Default behavior requires authentication of the same resource as the invited one
335
385
  You would have a <tt>User</tt> model which is configured as invitable and an <tt>Admin</tt> model which is not. If you want to allow only admins to send invitations, simply overwrite the <tt>authenticate_inviter!</tt> method as follow:
336
386
 
337
387
  class ApplicationController < ActionController::Base
338
- protected
339
- def authenticate_inviter!
340
- authenticate_admin!(force: true)
341
- end
388
+ protected
389
+
390
+ def authenticate_inviter!
391
+ authenticate_admin!(force: true)
392
+ end
342
393
  end
343
394
 
344
395
  And include <tt>DeviseInvitable::Inviter</tt> module into <tt>Admin</tt> model:
@@ -31,7 +31,7 @@ class Devise::InvitationsController < DeviseController
31
31
  respond_with resource, location: after_invite_path_for(current_inviter, resource)
32
32
  end
33
33
  else
34
- respond_with_navigational(resource) { render :new }
34
+ respond_with(resource)
35
35
  end
36
36
  end
37
37
 
@@ -51,9 +51,10 @@ class Devise::InvitationsController < DeviseController
51
51
  yield resource if block_given?
52
52
 
53
53
  if invitation_accepted
54
- if Devise.allow_insecure_sign_in_after_accept
54
+ if resource.class.allow_insecure_sign_in_after_accept
55
55
  flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
56
56
  set_flash_message :notice, flash_message if is_flashing_format?
57
+ resource.after_database_authentication
57
58
  sign_in(resource_name, resource)
58
59
  respond_with resource, location: after_accept_path_for(resource)
59
60
  else
@@ -62,7 +63,7 @@ class Devise::InvitationsController < DeviseController
62
63
  end
63
64
  else
64
65
  resource.invitation_token = raw_invitation_token
65
- respond_with_navigational(resource) { render :edit }
66
+ respond_with(resource)
66
67
  end
67
68
  end
68
69
 
@@ -75,42 +76,42 @@ class Devise::InvitationsController < DeviseController
75
76
 
76
77
  protected
77
78
 
78
- def invite_resource(&block)
79
- resource_class.invite!(invite_params, current_inviter, &block)
80
- end
79
+ def invite_resource(&block)
80
+ resource_class.invite!(invite_params, current_inviter, &block)
81
+ end
81
82
 
82
- def accept_resource
83
- resource_class.accept_invitation!(update_resource_params)
84
- end
83
+ def accept_resource
84
+ resource_class.accept_invitation!(update_resource_params)
85
+ end
85
86
 
86
- def current_inviter
87
- authenticate_inviter!
88
- end
87
+ def current_inviter
88
+ authenticate_inviter!
89
+ end
89
90
 
90
- def has_invitations_left?
91
- unless current_inviter.nil? || current_inviter.has_invitations_left?
92
- self.resource = resource_class.new
93
- set_flash_message :alert, :no_invitations_remaining if is_flashing_format?
94
- respond_with_navigational(resource) { render :new }
91
+ def has_invitations_left?
92
+ unless current_inviter.nil? || current_inviter.has_invitations_left?
93
+ self.resource = resource_class.new
94
+ set_flash_message :alert, :no_invitations_remaining if is_flashing_format?
95
+ respond_with_navigational(resource) { render :new }
96
+ end
95
97
  end
96
- end
97
98
 
98
- def resource_from_invitation_token
99
- unless params[:invitation_token] && self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)
100
- set_flash_message(:alert, :invitation_token_invalid) if is_flashing_format?
101
- redirect_to after_sign_out_path_for(resource_name)
99
+ def resource_from_invitation_token
100
+ unless params[:invitation_token] && self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)
101
+ set_flash_message(:alert, :invitation_token_invalid) if is_flashing_format?
102
+ redirect_to invalid_token_path_for(resource_name)
103
+ end
102
104
  end
103
- end
104
105
 
105
- def invite_params
106
- devise_parameter_sanitizer.sanitize(:invite)
107
- end
106
+ def invite_params
107
+ devise_parameter_sanitizer.sanitize(:invite)
108
+ end
108
109
 
109
- def update_resource_params
110
- devise_parameter_sanitizer.sanitize(:accept_invitation)
111
- end
110
+ def update_resource_params
111
+ devise_parameter_sanitizer.sanitize(:accept_invitation)
112
+ end
112
113
 
113
- def translation_scope
114
- 'devise.invitations'
115
- end
114
+ def translation_scope
115
+ 'devise.invitations'
116
+ end
116
117
  end
@@ -1,17 +1,17 @@
1
1
  class DeviseInvitable::RegistrationsController < Devise::RegistrationsController
2
2
  protected
3
3
 
4
- def build_resource(hash = {})
5
- if hash[:email]
6
- self.resource = resource_class.where(email: hash[:email]).first
7
- if self.resource && self.resource.respond_to?(:invited_to_sign_up?) && self.resource.invited_to_sign_up?
8
- self.resource.attributes = hash
9
- self.resource.send_confirmation_instructions if self.resource.confirmation_required_for_invited?
10
- self.resource.accept_invitation
11
- else
12
- self.resource = nil
4
+ def build_resource(hash = {})
5
+ if hash[:email]
6
+ self.resource = resource_class.where(email: hash[:email]).first
7
+ if self.resource && self.resource.respond_to?(:invited_to_sign_up?) && self.resource.invited_to_sign_up?
8
+ self.resource.attributes = hash
9
+ self.resource.send_confirmation_instructions if self.resource.confirmation_required_for_invited?
10
+ self.resource.accept_invitation
11
+ else
12
+ self.resource = nil
13
+ end
13
14
  end
15
+ self.resource ||= super
14
16
  end
15
- self.resource ||= super
16
- end
17
17
  end
@@ -7,7 +7,7 @@
7
7
  <% if f.object.class.require_password_on_accepting %>
8
8
  <div class="field">
9
9
  <%= f.label :password %><br />
10
- <%= f.password_field :password %></p>
10
+ <%= f.password_field :password %>
11
11
  </div>
12
12
 
13
13
  <div class="field">
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p><%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %></p>
4
4
 
5
- <p><%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, :invitation_token => @token) %></p>
5
+ <p><%= link_to t("devise.mailer.invitation_instructions.accept"), accept_invitation_url(@resource, invitation_token: @token) %></p>
6
6
 
7
7
  <% if @resource.invitation_due_at %>
8
8
  <p><%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %></p>
@@ -2,7 +2,7 @@
2
2
 
3
3
  <%= t("devise.mailer.invitation_instructions.someone_invited_you", url: root_url) %>
4
4
 
5
- <%= accept_invitation_url(@resource, :invitation_token => @token) %>
5
+ <%= accept_invitation_url(@resource, invitation_token: @token) %>
6
6
 
7
7
  <% if @resource.invitation_due_at %>
8
8
  <%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
@@ -0,0 +1,23 @@
1
+ ar:
2
+ devise:
3
+ failure:
4
+ invited: 'لديك دعوة معلّقة، يجب عليك قبولها للإنتهاء من إنشاء حسابك.'
5
+ invitations:
6
+ send_instructions: 'تم إرسال الدعوة إلى البريد الإلكتروني %{email}.'
7
+ invitation_token_invalid: 'كود الدعوة غير صحيح'
8
+ updated: 'تم تحديد كلمة المرور الخاص بك، انت الآن مسجل دخول.'
9
+ no_invitations_remaining: "لم يبق لديك دعوات"
10
+ invitation_removed: 'تم حذف دعوتك.'
11
+ new:
12
+ header: "ارسال الدعوة"
13
+ submit_button: "ارسل الدعوة"
14
+ edit:
15
+ header: "تحديد كلمة المرور"
16
+ submit_button: "حدد كلمة المرور"
17
+ mailer:
18
+ invitation_instructions:
19
+ subject: 'تعليمات الدعوة'
20
+ hello: 'مرحبا %{email}'
21
+ someone_invited_you: 'تم إرسال دعوة لك إلى %{url}, يمكنك الموافقة من خلال الرابط في الأسفل'
22
+ accept: 'قبول الدعوة'
23
+ ignore: "إذا كنت لا تريد قبول الدعوة، الرجاء تجاهل هذا البريد.<br />لن يتم إنشاء حساب خاص بك إلا إذا دخلت على الرابط أعلاه وحددت كلمة مرور خاص بك."
@@ -0,0 +1,32 @@
1
+
2
+ ca:
3
+ devise:
4
+ failure:
5
+ invited: "Tens una invitació pendent, accepta-la per acabar de crear el teu compte."
6
+ invitations:
7
+ send_instructions: "S'ha enviat una invitació a %{email}."
8
+ invitation_token_invalid: "La invitació no es vàlida!"
9
+ updated: "S'ha configurat la seva contrasenya i s'ha ingressat al sistema"
10
+ updated_not_active: "La seva contrasenya s'ha configurat correctament."
11
+ no_invitations_remaining: "No queden invitacions"
12
+ invitation_removed: "S'ha retirat la seva invitació"
13
+ new:
14
+ header: "Enviar Invitació"
15
+ submit_button: "Envia una invitació"
16
+ edit:
17
+ header: "Establir contrasenya"
18
+ submit_button: "Guardar la meva contrasenya"
19
+ mailer:
20
+ invitation_instructions:
21
+ subject: "Instruccions de la invitació"
22
+ hello: "Hola %{email}"
23
+ someone_invited_you: "Has estat invitat a %{url}, pots acceptar-ho seguint el següent enllaç"
24
+ accept: "Aceptar la invitació"
25
+ accept_until: "Aquesta invitació expirarà en %{due_date}."
26
+ ignore: "Si no li interessa aquesta invitació, simplement ignori aquest correu. No es crearà el teu compte fins que accedeixis a l'anterior enllaç i creïs una contrasenya"
27
+ time:
28
+ formats:
29
+ devise:
30
+ mailer:
31
+ invitation_instructions:
32
+ accept_until_format: "%d de %B de %Y, %H:%M"
@@ -0,0 +1,41 @@
1
+ da:
2
+ activerecord:
3
+ attributes:
4
+ user:
5
+ invitation_token: Invitationsnøgle
6
+ invitation_created_at: Invitation oprettet
7
+ invitation_sent_at: Invitation sendt
8
+ invitation_accepted_at: Invitation accepteret
9
+ invitation_limit: Invitationsbegrænsning
10
+ invited_by: Inviteret af
11
+ invitations_count: Antal invitationer
12
+ devise:
13
+ failure:
14
+ invited: "Du har allerede en ventende invitation, som du bedes acceptere for at oprette en konto."
15
+ invitations:
16
+ send_instructions: "Der er sendt en invitationsmail til %{email}."
17
+ invitation_token_invalid: "Den angivne invitationsnøgle er ikke gyldig."
18
+ updated: "Din adgangskode er gemt, og du er nu logget ind."
19
+ updated_not_active: "Din adgangskode er gemt, og du kan nu logge ind på din konto."
20
+ no_invitations_remaining: "Ikke flere invitationer tilbage"
21
+ invitation_removed: "Din invitation er blevet fjernet."
22
+ new:
23
+ header: "Send en invitation"
24
+ submit_button: "Send mail"
25
+ edit:
26
+ header: "Vælg din adgangskode"
27
+ submit_button: "Gem adgangskode"
28
+ mailer:
29
+ invitation_instructions:
30
+ subject: "Invitation til at oprette en konto"
31
+ hello: "Hej %{email}"
32
+ someone_invited_you: "Du er blevet inviteret til at oprette en konto på %{url}, og du kan gøre det via linket herunder."
33
+ accept: "Accepter invitation"
34
+ accept_until: "Invitation gælder indtil %{due_date}."
35
+ ignore: "Hvis du ikke vil tage imod invitationen om at oprette en konto, kan du blot ignorere denne mail.<br />\nDer vil ikke blive oprettet nogen konto, medmindre du følger linket herover og derefter opretter en adgangskode."
36
+ time:
37
+ formats:
38
+ devise:
39
+ mailer:
40
+ invitation_instructions:
41
+ accept_until_format: "%e. %B %Y kl. %H.%M"
@@ -0,0 +1,31 @@
1
+ de:
2
+ devise:
3
+ failure:
4
+ invited: "Du hast bereits eine Einladung erhalten. Nimm die Einladung an um dein Nutzerkonto zu erstellen."
5
+ invitations:
6
+ send_instructions: "Eine Einladung wurde an %{email} verschickt."
7
+ invitation_token_invalid: "Der Einladungs-Code ist ungültig!"
8
+ updated: "Dein Passwort wurde gesetzt. Du bist nun angemeldet."
9
+ updated_not_active: "Dein Passwort wurde gesetzt."
10
+ no_invitations_remaining: "Es gibt keine weiteren Einladungen"
11
+ invitation_removed: "Deine Einladung wurde gelöscht."
12
+ new:
13
+ header: "Einladung schicken"
14
+ submit_button: "Einladung schicken"
15
+ edit:
16
+ header: "Setze ein Passwort"
17
+ submit_button: "Passwort setzen"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "Einladung"
21
+ hello: "Hallo %{email}"
22
+ someone_invited_you: "Jemand hat dich zu %{url} eingeladen. Du kannst die Einladung mit dem Link unten annehmen."
23
+ accept: "Einladung annehmen"
24
+ accept_until: "Diese Einladung ist gültig bis zum %{due_date}."
25
+ ignore: "Wenn du die Einladung nicht annehmen willst, ignoriere diese E-Mail einfach. Es wird kein Benutzerkonto erstellt solange du nicht die Einladung mittels des Links oben annimmst."
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%d. %B %Y %H:%M"
@@ -0,0 +1,31 @@
1
+ es:
2
+ devise:
3
+ failure:
4
+ invited: "Tienes una invitación pendiente, acéptala para acabar de crear tu cuenta."
5
+ invitations:
6
+ send_instructions: "Se ha enviado una invitación a %{email}."
7
+ invitation_token_invalid: "¡La invitación no es válida!"
8
+ updated: "Se ha configurado su contraseña y ha ingresado al sistema"
9
+ updated_not_active: "Su contraseña se ha configurado correctamente."
10
+ no_invitations_remaining: "No quedan invitaciones"
11
+ invitation_removed: "Se ha retirado su invitación"
12
+ new:
13
+ header: "Enviar Invitación"
14
+ submit_button: "Envía una invitación"
15
+ edit:
16
+ header: "Establecer contraseña"
17
+ submit_button: "Guardar mi contraseña"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "Instrucciones de la invitación"
21
+ hello: "Hola %{email}"
22
+ someone_invited_you: "Has sido invitado a %{url}, puedes aceptarlo siguiendo el siguiente enlace"
23
+ accept: "Aceptar la invitación"
24
+ accept_until: "Esta invitación expirará en %{due_date}."
25
+ ignore: "Si no le interesa esta invitación, simplemente ignore este correo. No se creará tu cuenta hasta que accedas al enlace anterior y crees una contraseña."
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%d de %B de %Y, %H:%M"
@@ -0,0 +1,23 @@
1
+ et:
2
+ devise:
3
+ failure:
4
+ invited: 'Sul on kutse ootel - aktsepteeri, et konto loomine lõpule viia.'
5
+ invitations:
6
+ send_instructions: 'Kutse on saadetud emailile %{email}.'
7
+ invitation_token_invalid: 'Antud kutse ei ole kehtiv!'
8
+ updated: 'Sinu salasõna on edukalt sätitud. Oled nüüd sisse logitud.'
9
+ no_invitations_remaining: "Kutseid pole rohkem järgi."
10
+ invitation_removed: 'Sinu kutse eemaldati.'
11
+ new:
12
+ header: "Kutse saatmine"
13
+ submit_button: "Saada kutse"
14
+ edit:
15
+ header: "Salasõna sättimine"
16
+ submit_button: "Säti mu salasõna"
17
+ mailer:
18
+ invitation_instructions:
19
+ subject: 'Kutse juhised'
20
+ hello: 'Tere, %{email}'
21
+ someone_invited_you: 'Keegi kutsus Sind aadressile %{url}. Kutse saad vastu võtta allolevalt lingilt.'
22
+ accept: 'Võta kutse vastu'
23
+ ignore: "Kui Sa ei soovi kutset vastu võtta, siis lihtsalt ignoreeri seda emaili.<br />Sinu kontot ei looda enne, kui oled ülalolevat linki külastanud ja oma salasõna määranud."
@@ -0,0 +1,31 @@
1
+ fa:
2
+ devise:
3
+ failure:
4
+ invited: "شما یک دعوت نامه در حال انتظار دارید، با قبول آن حساب خود را بسازید."
5
+ invitations:
6
+ send_instructions: "یک ایمیل دعوت نامه به %{email} ارسال شد."
7
+ invitation_token_invalid: "کد دعوت نامه معتبر نیست!"
8
+ updated: "رمز عبور شما ذخیره شد. شما وارد سایت شدید!"
9
+ updated_not_active: "رمز عبور شما ذخیره شد."
10
+ no_invitations_remaining: "دعوت نامه ای نمانده"
11
+ invitation_removed: "دعوت نامه شما حذف شده."
12
+ new:
13
+ header: "فرستادن دعوت نامه"
14
+ submit_button: "فرستادن دعوت نامه"
15
+ edit:
16
+ header: "رمز عبور انتخاب کنید"
17
+ submit_button: "رمز عبور ذخیره کن"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "شما دعوت شدید!"
21
+ hello: "سلام %{email}"
22
+ someone_invited_you: "شما به %{url} دعوت شدید. لینک زیر را استفاده کنید تا حساب شما فعال شود."
23
+ accept: "قبول دعوت"
24
+ accept_until: "این دعوت نامه تا تاریخ %{due_date} اعتبار دارد."
25
+ ignore: "اگر نمی خواهید این دعوت را قبول کنید, لطفا این ایمیل را نادیده بگیرید.<br />تا وقتی که بر روی لینک بالا کلیک نکنید، حساب شما ساخته نخواهد شد."
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%B %d, %Y %I:%M %p"