devise_invitable 2.0.1 → 2.0.6

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.

Potentially problematic release.


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

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60a516052fe7d7f32929e0d35df374e05405951924011c1e7922c046fd8f8f73
4
- data.tar.gz: 4b790b2133f56ecd6dc5ac1736976bc1a689478e2094f093cfcb4ea2d19e1a39
3
+ metadata.gz: 3803fa69fe6bdecc811ab934878cc365f31ae0a124e54bbde34ad967752f1d3c
4
+ data.tar.gz: df5c2b785956d22e8bf69d644326605a649f1fd76b1d19af04d4bcd48a3c15f6
5
5
  SHA512:
6
- metadata.gz: 5fa8ed65bcf5ae7647aa798e9f63bbe20d19e0d87e28e1f0dc44f04dcc406e16980ffaa09cf94bb66ac6219c0d4d29829bafdd4fd3cdd86c2b628647ff05e14d
7
- data.tar.gz: 9fcff0bb96a9c6f81345c772b48ecace9bb446583328ac942d521c292533dae8132078a3593d30419c48abae381a8c87a4519e97d73dca2a76bfb15702334af8
6
+ metadata.gz: 925df2c1ef1a893f9e4d9b376b298fa5e21a4c516d8829d7990aa5e5b4a18a7d288d209658f38a1793c51b5a4fca83cbff814a19f2e725ddd8baa4307f448092
7
+ data.tar.gz: 4380da8ff7d5ff6e680393ab8f8935dae7b10e3d50271fdfaa839d0968caad99a56282ba6765b3d18f2f70090796c607c0198dc3932f3ac21f24821a8635a4e5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 2.0.6
2
+ - Fix submit form failure with turbolinks, fixes ([#865](https://github.com/scambra/devise_invitable/issues/865))
3
+ - Fix obsolete symbols in German translation ([#864](https://github.com/scambra/devise_invitable/pull/864))
4
+
5
+ ## 2.0.5
6
+ - Fix NoMethodError in random_password when validatable is not used ([#850](https://github.com/scambra/devise_invitable/pull/850))
7
+
8
+ ## 2.0.4
9
+ - Fix devise deprecations ([#842](https://github.com/scambra/devise_invitable/pull/842))
10
+ - Update translations ([#844](https://github.com/scambra/devise_invitable/pull/844), [#845](https://github.com/scambra/devise_invitable/pull/845))
11
+ - Fix/enforce initial password length to follow devise ([#848](https://github.com/scambra/devise_invitable/pull/848))
12
+
13
+ ## 2.0.3
14
+ - Add locales ([#834](https://github.com/scambra/devise_invitable/pull/834), [#835](https://github.com/scambra/devise_invitable/pull/835))
15
+ - Remove index on invitations_count column ([#830](https://github.com/scambra/devise_invitable/pull/830))
16
+
17
+ ## 2.0.2
18
+ - Fix ruby 2.7 deprecation warning
19
+
1
20
  ## 2.0.1
2
21
  - Use per-model allow_insecure_sign_in_after_accept ([#790](https://github.com/scambra/devise_invitable/pull/790))
3
22
 
data/README.rdoc CHANGED
@@ -1,5 +1,5 @@
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] {<img src="https://travis-ci.org/scambra/devise_invitable.svg"/>}[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]
3
3
 
4
4
  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
5
 
@@ -35,14 +35,14 @@ Replace MODEL by the class name you want to add DeviseInvitable, like <tt>User</
35
35
 
36
36
  Follow the walkthrough for Devise and after it's done, follow this walkthrough.
37
37
 
38
- == Devise Configuration
38
+ ==== Devise Configuration
39
39
  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
40
 
41
41
  class User < ActiveRecord::Base
42
42
  devise :database_authenticatable, :confirmable, :invitable
43
43
  end
44
44
 
45
- == ActiveRecord Migration
45
+ ==== ActiveRecord Migration
46
46
  Add <tt>t.invitable</tt> to your Devise model migration:
47
47
 
48
48
  create_table :users do
@@ -181,15 +181,15 @@ To change behaviour of inviting or accepting users, you can simply override two
181
181
  class Users::InvitationsController < Devise::InvitationsController
182
182
  private
183
183
 
184
- # this is called when creating invitation
185
- # should return an instance of resource class
184
+ # This is called when creating invitation.
185
+ # It should return an instance of resource class.
186
186
  def invite_resource
187
187
  # skip sending emails on invite
188
188
  super { |user| user.skip_invitation = true }
189
189
  end
190
190
 
191
- # this is called when accepting invitation
192
- # should return an instance of resource class
191
+ # This is called when accepting invitation.
192
+ # It should return an instance of resource class.
193
193
  def accept_resource
194
194
  resource = resource_class.accept_invitation!(update_resource_params)
195
195
  # Report accepting invitation to analytics
@@ -217,6 +217,61 @@ Here is an example of what your application controller might need to include in
217
217
  devise_parameter_sanitizer.permit(:accept_invitation, keys: [:first_name, :last_name, :phone])
218
218
  end
219
219
 
220
+ Here is an example setting a User's first name, last name, and role for a custom invitation:
221
+
222
+ #Configuring the InvitationsController to accept :first_name, :last_name, and :role
223
+
224
+ class Users::InvitationsController < Devise::InvitationsController
225
+ before_action :configure_permitted_parameters
226
+
227
+ protected
228
+
229
+ # Permit the new params here.
230
+ def configure_permitted_parameters
231
+ devise_parameter_sanitizer.permit(:invite, keys: [:first_name, :last_name, :role])
232
+ end
233
+ end
234
+
235
+ #Define your roles in the User model
236
+
237
+ class User < ApplicationRecord
238
+ has_many :models
239
+
240
+ enum role: {Role 1 Name: 0, Role 2 Name: 1, Role 3 Name: 2, etc...}
241
+ end
242
+
243
+ #In the Invitation view
244
+
245
+ <h2><%= t "devise.invitations.new.header" %></h2>
246
+
247
+ <%= form_for(resource, as: resource_name, url: invitation_path(resource_name), html: { method: :post }) do |f| %>
248
+ <%= render "devise/shared/error_messages", resource: resource %>
249
+ <% resource.class.invite_key_fields.each do |field| -%>
250
+ <div class="field">
251
+ <%= f.label field %><br />
252
+ <%= f.text_field field %>
253
+ </div>
254
+ <% end %>
255
+
256
+ <div class="field">
257
+ <%= f.label :first_name %>
258
+ <%= f.text_field :first_name %>
259
+ </div>
260
+
261
+ <div class="field">
262
+ <%= f.label :last_name %>
263
+ <%= f.text_field :last_name %>
264
+ </div>
265
+
266
+ <div class="field">
267
+ <%= f.label :role %>
268
+ <%= f.select :role, options_for_select(User.roles.map { |key, value| [key.humanize, key] }), {prompt: "Select Role"} %>
269
+ </div>
270
+
271
+ <div class="actions">
272
+ <%= f.submit t("devise.invitations.new.submit_button") %>
273
+ </div>
274
+ <% end %>
220
275
 
221
276
  == Usage
222
277
 
@@ -234,8 +289,8 @@ If you want to create the invitation but not send it, you can set <tt>skip_invit
234
289
  end
235
290
  # => the record will be created, but the invitation email will not be sent
236
291
 
237
- When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt>
238
- the value is temporarily available when you invite a user and will be decrypted when received.
292
+ When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt>.
293
+ This value is temporarily available when you invite a user and will be decrypted when received.
239
294
 
240
295
  accept_user_invitation_url(invitation_token: user.raw_invitation_token)
241
296
 
@@ -308,7 +363,7 @@ A pair of scopes to find those users that have accepted, and those that have not
308
363
 
309
364
  == Integration in a Rails application
310
365
 
311
- 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.
366
+ 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.
312
367
  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).
313
368
 
314
369
  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.
@@ -317,7 +372,7 @@ After an invitation is accepted, the invitee will be redirected to <tt>after_acc
317
372
 
318
373
  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>.
319
374
 
320
- 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.
375
+ 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.
321
376
 
322
377
  == Controller filter
323
378
 
@@ -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_navigational(resource) { render :new, status: :unprocessable_entity }
35
35
  end
36
36
  end
37
37
 
@@ -54,6 +54,7 @@ class Devise::InvitationsController < DeviseController
54
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_navigational(resource) { render :edit, status: :unprocessable_entity }
66
67
  end
67
68
  end
68
69
 
@@ -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,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: "Instruciones 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"
@@ -0,0 +1,34 @@
1
+ fr:
2
+ devise:
3
+ failure:
4
+ invited: "Vous avez une invitation en attente, acceptez-la pour terminer la création de votre compte."
5
+ invitations:
6
+ send_instructions: "Un e-mail d'invitation a été envoyé à %{email}."
7
+ invitation_token_invalid: "Le jeton d'invitation fourni n'est pas valide!"
8
+ updated: 'Votre mot de passe a été défini avec succès. Vous êtes maintenant connecté.'
9
+ updated_not_active: "Votre mot de passe a été défini avec succès."
10
+ no_invitations_remaining: "Il n'y a plus d'invitations restantes"
11
+ invitation_removed: 'Votre invitation a été supprimée.'
12
+ new:
13
+ header: Nouvel utilisateur
14
+ legend: Envoyer l’invitation
15
+ submit_button: Envoyer
16
+ edit:
17
+ header: Confirmation
18
+ submit_button: Confirmer
19
+ new_password: Mot de passe
20
+ new_password_confirmation: Confirmation du mot de passe
21
+ mailer:
22
+ invitation_instructions:
23
+ subject: 'Vous avez reçu une invitation'
24
+ hello: 'Bonjour %{email}'
25
+ someone_invited_you: "Vous avez été invité à rejoindre %{url}, vous pouvez accepter cette invitation via le lien ci-dessous."
26
+ accept: "Accepter l'invitation"
27
+ accept_until: "Cette invitation sera valable jusqu'au %{due_date}."
28
+ ignore: "Si vous ne souhaitez pas accepter cette invitation, veuillez ignorer cet e-mail.<br />Votre compte ne sera pas créé tant que vous n'accéderez pas au lien ci-dessous et que vous ayez défini votre mot de passe."
29
+ time:
30
+ formats:
31
+ devise:
32
+ mailer:
33
+ invitation_instructions:
34
+ accept_until_format: "%B %d, %Y %I:%M %p"
@@ -0,0 +1,31 @@
1
+ it:
2
+ devise:
3
+ failure:
4
+ invited: "Hai un invito in sospeso, accettalo per completare la creazione del tuo account."
5
+ invitations:
6
+ send_instructions: "Un'email di invito è stata inoltrata a %{email}."
7
+ invitation_token_invalid: "Il token di invito fornito non è valido!"
8
+ updated: "La tua password è stata impostata correttamente. Ora sei connesso."
9
+ updated_not_active: "La tua password è stata impostata correttamente."
10
+ no_invitations_remaining: "Non sono più disponibili inviti."
11
+ invitation_removed: "Il tuo invito è stato rimosso."
12
+ new:
13
+ header: "Inoltra l'invito"
14
+ submit_button: "Inoltra un invito"
15
+ edit:
16
+ header: "Imposta la tua password"
17
+ submit_button: "Imposta la password"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "Istruzioni per l'invito"
21
+ hello: "Buongiorno %{email}"
22
+ someone_invited_you: "Qualcuno ti ha invitato a %{url}, accetta tramite il link qua sotto."
23
+ accept: "Accetta l'invito"
24
+ accept_until: "L'invito sarà valido fino a %{due_date}."
25
+ ignore: "Se non si desidera accettare l'invito si prega di ignorare la presente email.<br />L'account non sarà creato finché non verrà impostata la password (v. link sotto)."
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%B %d, %Y %I:%M %p"
@@ -0,0 +1,31 @@
1
+ ja:
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: '%Y年%m月%d日%H時%M分'
@@ -0,0 +1,24 @@
1
+ ko:
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
+ ignore: "초대를 원치 않을 경우 이 이메일을 무시해도 됩니다.<br />위의 링크로 접속하여 귀하의 비밀번호를 설정하여 계정을 생성할 수 있습니다."
@@ -0,0 +1,32 @@
1
+ nl:
2
+ devise:
3
+ failure:
4
+ invited: "U bent reeds uitgenodigd, accepteer de uitnodiging die u heeft ontvangen per mail om uw account te accepteren."
5
+ invitations:
6
+ send_instructions: "Een uitnodigingsmail aan %{email} is verstuurd."
7
+ invitation_token_invalid: "De uitnodigingscode is ongeldig!"
8
+ updated: "Uw wachtwoord is ingesteld. U bent nu ingelogd."
9
+ updated_not_active: "Uw wachtwoord is ingesteld."
10
+ no_invitations_remaining: "Geen uitnodigingen over."
11
+ invitation_removed: "Uw uitnodiging is verwijderd."
12
+ new:
13
+ header: "Verstuur uitnodiging"
14
+ submit_button: "Verstuur een uitnodiging"
15
+ edit:
16
+ header: "Stel Uw wachtwoord in"
17
+ submit_button: "Stel mijn wachtwoord in"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "Instructies voor uitnodigingen"
21
+ hello: "Beste %{email}"
22
+ someone_invited_you: "Iemand heeft U uitgenodigd voor %{url}, U kunt de uitnodiging accepteren via onderstaande link."
23
+ accept: "Accepteer uitnodiging"
24
+ accept_until: "Deze uitnodoging vervalt per %{due_date}."
25
+ ignore: "Indien U de uitnodiging niet wenst te accepteren, negeer dan alstublieft deze email.<br />\nUw account wordt niet aangemaakt indien U niet via bovenstaande link uw wachtwoord aanmaakt."
26
+
27
+ time:
28
+ formats:
29
+ devise:
30
+ mailer:
31
+ invitation_instructions:
32
+ accept_until_format: "%a %d %b %Y %H:%M:%S %Z"
@@ -0,0 +1,17 @@
1
+ "no":
2
+ devise:
3
+ invitations:
4
+ send_instructions: 'En epost med invitasjon er sent til %{email}.'
5
+ invitation_token_invalid: 'Autentiseringskoden er ikke gyldig!'
6
+ updated: 'Passordet ble oppdatert suksessfullt. Du er nå logget inn.'
7
+ no_invitations_remaining: 'Ingen gjenværende invitasjoner.'
8
+ invitation_removed: 'Din invitasjon ble fjernet.'
9
+ new:
10
+ header: 'Send invitasjon'
11
+ submit_button: 'Send en invitasjon'
12
+ edit:
13
+ header: 'Sett ditt passord'
14
+ submit_button: 'Sett mitt passord'
15
+ mailer:
16
+ invitation_instructions:
17
+ subject: 'Invitasjonsinstruksjoner'
@@ -0,0 +1,31 @@
1
+ pl:
2
+ devise:
3
+ failure:
4
+ invited: "Posiadasz oczekujące zaproszenie, zaakceptuj je aby ukończyć proces rejestracji."
5
+ invitations:
6
+ send_instructions: "E-mail z zaproszeniem został wysłany do %{email}."
7
+ invitation_token_invalid: "Kod zaproszenia jest nieprawidłowy."
8
+ updated: "Twoje hasło zostało pomyślnie ustawione. Jesteś teraz zalogowany."
9
+ updated_not_active: "Twoje hasło zostało ustawione."
10
+ no_invitations_remaining: "Brak oczekujących zaproszeń"
11
+ invitation_removed: "Twoje zaproszenie zostało usunięte."
12
+ new:
13
+ header: "Wyślij zaproszenie"
14
+ submit_button: "Wyślij zaproszenie"
15
+ edit:
16
+ header: "Ustaw swoje hasło"
17
+ submit_button: "Zapisz moje hasło"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "Instrukcja do zaproszenia"
21
+ hello: "Cześć %{email}"
22
+ someone_invited_you: "Ktoś zaprosił Cię do %{url}. Zaproszenie możesz zaakceptować przez podany link."
23
+ accept: "Przyjmij zaproszenie"
24
+ accept_until: "Zaprosze będzie ważne do %{due_date}."
25
+ ignore: "Jeśli nie chcesz przyjąć zaproszenia, zignoruj tę wiadomość.<br />Twoje konto nie zostanie utworzone do momentu ustawienia przez Ciebie hasła."
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%B %d, %Y %I:%M %p"
@@ -0,0 +1,23 @@
1
+ pt_BR:
2
+ devise:
3
+ failure:
4
+ invited: 'Você tem um convite pendente, aceite para finalizar sua conta.'
5
+ invitations:
6
+ send_instructions: 'Um email de convite foi enviado para %{email}.'
7
+ invitation_token_invalid: 'O código do convite não é válido!'
8
+ updated: 'Sua senha foi atualizada com sucesso. Você está autenticado agora.'
9
+ no_invitations_remaining: "Sem convites pendentes"
10
+ invitation_removed: 'Seu convite foi removido.'
11
+ new:
12
+ header: "Enviar convite"
13
+ submit_button: "Enviar um convite"
14
+ edit:
15
+ header: "Escolha sua senha"
16
+ submit_button: "Atualizar minha senha"
17
+ mailer:
18
+ invitation_instructions:
19
+ subject: 'Instruções do convite'
20
+ hello: 'Olá %{email}'
21
+ someone_invited_you: 'Alguém convidou você para acessar %{url}, você pode aceitar o convite através do link abaixo.'
22
+ accept: 'Aceitar convite'
23
+ ignore: "Se você não quer aceitar esse convite, por favor ignore esse e-mail.<br />Sua conta não será criada até você acessar o link abaixo e escolher sua senha."
@@ -0,0 +1,23 @@
1
+ pt:
2
+ devise:
3
+ failure:
4
+ invited: 'Você tem um convite pendente, aceite para finalizar sua conta.'
5
+ invitations:
6
+ send_instructions: 'Um email de convite foi enviado para %{email}.'
7
+ invitation_token_invalid: 'O código do convite não é válido!'
8
+ updated: 'Sua senha foi atualizada com sucesso. Você está autenticado agora.'
9
+ no_invitations_remaining: "Sem convites pendentes"
10
+ invitation_removed: 'Seu convite foi removido.'
11
+ new:
12
+ header: "Enviar convite"
13
+ submit_button: "Enviar um convite"
14
+ edit:
15
+ header: "Escolha sua senha"
16
+ submit_button: "Atualizar minha senha"
17
+ mailer:
18
+ invitation_instructions:
19
+ subject: 'Instruções do convite'
20
+ hello: 'Olá %{email}'
21
+ someone_invited_you: 'Alguém convidou você para acessar %{url}, você pode aceitar o convite através do link abaixo.'
22
+ accept: 'Aceitar convite'
23
+ ignore: "Se você não quer aceitar esse convite, por favor ignore esse e-mail.<br />Sua conta não será criada até você acessar o link abaixo e escolher sua senha."
@@ -0,0 +1,23 @@
1
+ ru:
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,24 @@
1
+ tr:
2
+ devise:
3
+ failure:
4
+ invited: "Hesap oluşturmak için bekleyen davetiyenizi kabul edin"
5
+ invitations:
6
+ send_instructions: "%{email} adresine davetiye maili gönderildi."
7
+ invitation_token_invalid: "Davetiye tokenı geçerli değil!"
8
+ updated: "Şifreniz başarıyla oluşturuldu ve giriş yaptınız"
9
+ updated_not_active: "Şifreniz başarıyla oluşturuldu."
10
+ no_invitations_remaining: "Davetiye kalmadı"
11
+ invitation_removed: "Davetiyeniz silindi"
12
+ new:
13
+ header: "Davetiye gönderildi"
14
+ submit_button: "Davetiye gönder"
15
+ edit:
16
+ header: "Şifre oluştur"
17
+ submit_button: "Şifremi oluştur"
18
+ mailer:
19
+ invitation_instructions:
20
+ subject: "Davetiye adımları"
21
+ hello: "Merhaba %{email}"
22
+ someone_invited_you: "%{url} adresine davet edildiniz. Kabul etmek için aşağıdaki linke tıklayınız."
23
+ accept: "Daveti kabul et"
24
+ ignore: "Daveti kabul etmek istemiyorsanız bu maili yoksayabilirsiniz.<br />Aşağıdaki linke tıklayıp şifrenizi oluşturmadan hesabınız oluşturulmayacaktır."
@@ -0,0 +1,31 @@
1
+ ua:
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: "%I:%M %p %B %d, %Y"
@@ -0,0 +1,25 @@
1
+ vi:
2
+ devise:
3
+ failure:
4
+ invited: "Bạn có một lời mời đang ở trạng thái chờ, hãy xác nhận nó để tạo tài khoản của bạn."
5
+ invitations:
6
+ send_instructions: "Một thư mời đã được gửi đến cho %{email}."
7
+ invitation_token_invalid: "Mã xác nhận không chính xác!"
8
+ updated: "Mật khẩu của bạn đã được thiết lập thành công. Bạn hiện đang đăng nhập."
9
+ updated_not_active: "Mật khẩu của bạn đã được thiết lập thành công."
10
+ no_invitations_remaining: "Không còn lời mời nào."
11
+ invitation_removed: "Lời mời của bạn đã bị xóa."
12
+ new:
13
+ header: "Gửi lời mời"
14
+ submit_button: "Gửi thư mời"
15
+ edit:
16
+ header: "Thiết lập mật khẩu"
17
+ submit_button: "Đặt mật khẩu"
18
+ mess: 'Hãy thiết lập mật khẩu của bạn để sử dụng dịch vụ'
19
+ mailer:
20
+ invitation_instructions:
21
+ subject: "Hướng dẫn"
22
+ hello: "Xin chào %{email}"
23
+ someone_invited_you: "Có một ai đó đã mời bạn ghé thăm %{url}, Bạn có thể chấp nhận lời mời này thông qua đường dẫn bên dưới."
24
+ accept: "Chấp nhận lời mời"
25
+ ignore: "Nếu bạn không muốn chấp nhận lời mời, xin vui lòng bỏ qua email này.<br />Tài khoản của bạn sẽ không được khởi tạo cho đến khi bạn truy cập vào đường dẫn ở trên và đặt mật khẩu cho tài khoản của bạn."
@@ -0,0 +1,31 @@
1
+ zh-HK:
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: "如果你唔想接受邀請, 請忽略此電子郵件。 系你訪問上面的連結並設置密碼之前, 不會創建您的帳戶。"
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%B %d, %Y %I:%M %p"
@@ -0,0 +1,31 @@
1
+ zh-TW:
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: "如果你不想接受邀請, 請忽略此電子郵件。在你透過上面的連結設置密碼前,都不會建立您的帳號。"
26
+ time:
27
+ formats:
28
+ devise:
29
+ mailer:
30
+ invitation_instructions:
31
+ accept_until_format: "%B %d, %Y %I:%M %p"
@@ -1,11 +1,17 @@
1
1
  module Devise
2
2
  module Models
3
3
  module Authenticatable
4
- BLACKLIST_FOR_SERIALIZATION.concat %i[
4
+ list = %i[
5
5
  invitation_token invitation_created_at invitation_sent_at
6
6
  invitation_accepted_at invitation_limit invited_by_type
7
7
  invited_by_id invitations_count
8
8
  ]
9
+
10
+ if defined?(UNSAFE_ATTRIBUTES_FOR_SERIALIZATION)
11
+ UNSAFE_ATTRIBUTES_FOR_SERIALIZATION.concat(list)
12
+ else
13
+ BLACKLIST_FOR_SERIALIZATION.concat(list)
14
+ end
9
15
  end
10
16
  end
11
17
  end
@@ -45,7 +45,7 @@ module Devise
45
45
  elsif defined?(Mongoid) && defined?(Mongoid::Document) && self < Mongoid::Document && Mongoid::VERSION >= '6.0.0'
46
46
  belongs_to_options.merge! optional: true
47
47
  end
48
- belongs_to :invited_by, belongs_to_options
48
+ belongs_to :invited_by, **belongs_to_options
49
49
 
50
50
  extend ActiveModel::Callbacks
51
51
  define_model_callbacks :invitation_created
@@ -158,7 +158,8 @@ module Devise
158
158
  self.downcase_keys if new_record_and_responds_to?(:downcase_keys)
159
159
  self.strip_whitespace if new_record_and_responds_to?(:strip_whitespace)
160
160
 
161
- if save(validate: false)
161
+ validate = options.key?(:validate) ? options[:validate] : self.class.validate_on_invite
162
+ if save(validate: validate)
162
163
  self.invited_by.decrement_invitation_limit! if !was_invited and self.invited_by.present?
163
164
  deliver_invitation(options) unless skip_invitation
164
165
  end
@@ -324,7 +325,7 @@ module Devise
324
325
  end
325
326
 
326
327
  yield invitable if block_given?
327
- mail = invitable.invite!(nil, options) if invitable.errors.empty?
328
+ mail = invitable.invite!(nil, options.merge(validate: false)) if invitable.errors.empty?
328
329
  [invitable, mail]
329
330
  end
330
331
 
@@ -397,7 +398,10 @@ module Devise
397
398
  # lower + upper case, a digit and a symbol.
398
399
  # For more unusual rules, this method can be overridden.
399
400
  def random_password
400
- 'aA1!' + Devise.friendly_token[0, 20]
401
+ length = respond_to?(:password_length) ? password_length : Devise.password_length
402
+
403
+ prefix = 'aA1!'
404
+ prefix + Devise.friendly_token(length.last - prefix.length)
401
405
  end
402
406
  end
403
407
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseInvitable
2
- VERSION = '2.0.1'.freeze
2
+ VERSION = '2.0.6'.freeze
3
3
  end
@@ -8,7 +8,6 @@ class DeviseInvitableAddTo<%= table_name.camelize %> < ActiveRecord::Migration<%
8
8
  t.integer :invitation_limit
9
9
  t.references :invited_by, polymorphic: true
10
10
  t.integer :invitations_count, default: 0
11
- t.index :invitations_count
12
11
  t.index :invitation_token, unique: true # for invitable
13
12
  t.index :invited_by_id
14
13
  end
@@ -17,13 +17,14 @@ class GeneratorsTest < ActiveSupport::TestCase
17
17
 
18
18
  test "rails g devise_invitable:install" do
19
19
  @output = `cd #{RAILS_APP_PATH} && rails g devise_invitable:install -p`
20
- assert @output.match(%r{(inject|insert).* config/initializers/devise\.rb\n})
20
+ puts @output
21
+ assert @output.match(%r{(inject|insert|File unchanged! The supplied flag value not found!).* config/initializers/devise\.rb\n})
21
22
  assert @output.match(%r|create.* config/locales/devise_invitable\.en\.yml\n|)
22
23
  end
23
24
 
24
25
  test "rails g devise_invitable Octopussy" do
25
26
  @output = `cd #{RAILS_APP_PATH} && rails g devise_invitable Octopussy -p`
26
- assert @output.match(%r{(inject|insert).* app/models/octopussy\.rb\n})
27
+ assert @output.match(%r{(inject|insert|File unchanged! The supplied flag value not found!).* app/models/octopussy\.rb\n})
27
28
  assert @output.match(%r|invoke.* #{DEVISE_ORM}\n|)
28
29
  if DEVISE_ORM == :active_record
29
30
  assert @output.match(%r|create.* db/migrate/\d{14}_devise_invitable_add_to_octopussies\.rb\n|)
@@ -1,6 +1,10 @@
1
1
  require 'test_helper'
2
2
  require 'model_tests_helper'
3
3
 
4
+ class Validatable < User
5
+ devise :validatable, password_length: 10..20
6
+ end
7
+
4
8
  class InvitableTest < ActiveSupport::TestCase
5
9
 
6
10
  def setup
@@ -760,4 +764,16 @@ class InvitableTest < ActiveSupport::TestCase
760
764
  assert user.persisted?
761
765
  assert user.errors.empty?
762
766
  end
767
+
768
+ test 'should set initial password following Devise.password_length' do
769
+ user = User.invite!(email: 'valid@email.com')
770
+ assert_empty user.errors
771
+ assert_equal Devise.password_length.last, user.password.length
772
+ end
773
+
774
+ test 'should set initial passsword using :validatable with custom password_length' do
775
+ user = Validatable.invite!(email: 'valid@email.com')
776
+ assert_empty user.errors
777
+ assert_equal Validatable.password_length.last, user.password.length
778
+ end
763
779
  end
@@ -0,0 +1,9 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ if Rails.version < '5.2.0'
8
+ RailsApp::Application.config.secret_token = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
9
+ end
@@ -32,7 +32,6 @@ class CreateTables < (Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRe
32
32
  t.timestamps :null => false
33
33
  end
34
34
  add_index :users, :invitation_token, :unique => true
35
- add_index :users, :invitations_count
36
35
 
37
36
  create_table :admins do |t|
38
37
  ## Database authenticatable
@@ -41,6 +40,5 @@ class CreateTables < (Rails.version < '5.1' ? ActiveRecord::Migration : ActiveRe
41
40
 
42
41
  t.integer :invitations_count, :default => 0
43
42
  end
44
- add_index :admins, :invitations_count
45
43
  end
46
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_invitable
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Cambra
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-05 00:00:00.000000000 Z
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.1
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.1
54
+ version: '2.0'
55
55
  description: It adds support for send invitations by email (it requires to be authenticated)
56
56
  and accept the invitation by setting a password.
57
57
  email:
@@ -69,7 +69,28 @@ files:
69
69
  - app/views/devise/invitations/new.html.erb
70
70
  - app/views/devise/mailer/invitation_instructions.html.erb
71
71
  - app/views/devise/mailer/invitation_instructions.text.erb
72
+ - config/locales/ar.yml
73
+ - config/locales/da.yml
74
+ - config/locales/de.yml
72
75
  - config/locales/en.yml
76
+ - config/locales/es.yml
77
+ - config/locales/et.yml
78
+ - config/locales/fa.yml
79
+ - config/locales/fr.yml
80
+ - config/locales/it.yml
81
+ - config/locales/ja.yml
82
+ - config/locales/ko.yml
83
+ - config/locales/nl.yml
84
+ - config/locales/no.yml
85
+ - config/locales/pl.yml
86
+ - config/locales/pt-BR.yml
87
+ - config/locales/pt.yml
88
+ - config/locales/ru.yml
89
+ - config/locales/tr.yml
90
+ - config/locales/ua.yml
91
+ - config/locales/vi.yml
92
+ - config/locales/zh-HK.yml
93
+ - config/locales/zh-TW.yml
73
94
  - lib/devise_invitable.rb
74
95
  - lib/devise_invitable/controllers/helpers.rb
75
96
  - lib/devise_invitable/inviter.rb
@@ -131,6 +152,7 @@ files:
131
152
  - test/rails_app/config/initializers/devise.rb
132
153
  - test/rails_app/config/initializers/inflections.rb
133
154
  - test/rails_app/config/initializers/mime_types.rb
155
+ - test/rails_app/config/initializers/secret_token.rb
134
156
  - test/rails_app/config/initializers/session_store.rb
135
157
  - test/rails_app/config/initializers/wrap_parameters.rb
136
158
  - test/rails_app/config/locales/devise.en.yml
@@ -146,7 +168,7 @@ homepage: https://github.com/scambra/devise_invitable
146
168
  licenses:
147
169
  - MIT
148
170
  metadata: {}
149
- post_install_message:
171
+ post_install_message:
150
172
  rdoc_options:
151
173
  - "--main"
152
174
  - README.rdoc
@@ -164,9 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
186
  - !ruby/object:Gem::Version
165
187
  version: '0'
166
188
  requirements: []
167
- rubyforge_project:
168
- rubygems_version: 2.7.8
169
- signing_key:
189
+ rubygems_version: 3.0.9
190
+ signing_key:
170
191
  specification_version: 4
171
192
  summary: An invitation strategy for Devise
172
193
  test_files:
@@ -212,6 +233,7 @@ test_files:
212
233
  - test/rails_app/config/initializers/devise.rb
213
234
  - test/rails_app/config/initializers/inflections.rb
214
235
  - test/rails_app/config/initializers/mime_types.rb
236
+ - test/rails_app/config/initializers/secret_token.rb
215
237
  - test/rails_app/config/initializers/session_store.rb
216
238
  - test/rails_app/config/initializers/wrap_parameters.rb
217
239
  - test/rails_app/config/locales/devise.en.yml