devise_invitable 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/config/locales/fr.yml +3 -5
- data/config/locales/id.yml +31 -0
- data/lib/devise_invitable/models.rb +2 -2
- data/lib/devise_invitable/version.rb +1 -1
- data/test/models/invitable_test.rb +53 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8ff92d4a82378780e01c6d3cfe57ff0808b08d49a619e3a899e94a86e7ec46c
|
4
|
+
data.tar.gz: 174e7982212230032987ad9b6b1ed572b98fda73fc0652e095ae71c1b6282436
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25a25c7ec4df1183ef43d399f73cb7a4b661cc33df172d660dd551f658bebce01ac552c837608affeac59aeaaa85b137ad56247278fbe5a436ea15d03131b1e3
|
7
|
+
data.tar.gz: 07a394b356fb623ab7a8ca48486acd935ea5c69b86969ccae667d414bc6d7319ec2e5fe90c0cdc8ff2a9f46eace35bfd517df659fc445088f4e43a0f6536590c
|
data/CHANGELOG.md
CHANGED
data/config/locales/fr.yml
CHANGED
@@ -14,10 +14,8 @@ fr:
|
|
14
14
|
legend: Envoyer l’invitation
|
15
15
|
submit_button: Envoyer
|
16
16
|
edit:
|
17
|
-
header:
|
18
|
-
submit_button:
|
19
|
-
new_password: Mot de passe
|
20
|
-
new_password_confirmation: Confirmation du mot de passe
|
17
|
+
header: Définissez votre mot de passe
|
18
|
+
submit_button: Définir mon mot de passe
|
21
19
|
mailer:
|
22
20
|
invitation_instructions:
|
23
21
|
subject: 'Vous avez reçu une invitation'
|
@@ -31,4 +29,4 @@ fr:
|
|
31
29
|
devise:
|
32
30
|
mailer:
|
33
31
|
invitation_instructions:
|
34
|
-
accept_until_format: "%B %d, %Y %I:%M %p"
|
32
|
+
accept_until_format: "%B %d, %Y %I:%M %p"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
id:
|
2
|
+
devise:
|
3
|
+
failure:
|
4
|
+
invited: "Anda memiliki undangan yang tertunda, harap terima undangan tersebut untuk menyelesaikan pembuatan akun Anda."
|
5
|
+
invitations:
|
6
|
+
send_instructions: "Email undangan telah dikirim ke %{email}."
|
7
|
+
invitation_token_invalid: "Token undangan yang diberikan tidak valid!"
|
8
|
+
updated: "Kata sandi Anda telah berhasil diatur. Anda sudah masuk."
|
9
|
+
updated_not_active: "Kata sandi Anda telah berhasil diatur."
|
10
|
+
no_invitations_remaining: "Tidak ada undangan tersisa."
|
11
|
+
invitation_removed: "Undangan Anda telah dihapus."
|
12
|
+
new:
|
13
|
+
header: "Kirim Undangan"
|
14
|
+
submit_button: "Kirim undangan"
|
15
|
+
edit:
|
16
|
+
header: "Atur kata sandi Anda"
|
17
|
+
submit_button: "Atur kata sandi"
|
18
|
+
mailer:
|
19
|
+
invitation_instructions:
|
20
|
+
subject: "Instruksi Undangan"
|
21
|
+
hello: "Halo %{email}"
|
22
|
+
someone_invited_you: "Seseorang telah mengundang Anda ke %{url}. Anda dapat menerima undangan ini melalui tautan di bawah ini."
|
23
|
+
accept: "Terima Undangan"
|
24
|
+
accept_until: "Undangan ini akan berakhir pada %{due_date}."
|
25
|
+
ignore: "Jika Anda tidak ingin menerima undangan ini, silakan abaikan email ini. Akun Anda tidak akan dibuat sampai Anda mengakses tautan di atas dan mengatur kata sandi Anda."
|
26
|
+
time:
|
27
|
+
formats:
|
28
|
+
devise:
|
29
|
+
mailer:
|
30
|
+
invitation_instructions:
|
31
|
+
accept_until_format: "%d %B %Y %H:%M:%S"
|
@@ -195,7 +195,7 @@ module Devise
|
|
195
195
|
def clear_reset_password_token
|
196
196
|
reset_password_token_present = reset_password_token.present?
|
197
197
|
super
|
198
|
-
accept_invitation! if reset_password_token_present &&
|
198
|
+
accept_invitation! if reset_password_token_present && valid_invitation?
|
199
199
|
end
|
200
200
|
|
201
201
|
def clear_errors_on_valid_keys
|
@@ -231,7 +231,7 @@ module Devise
|
|
231
231
|
def add_taken_error(key)
|
232
232
|
errors.add(key, :taken)
|
233
233
|
end
|
234
|
-
|
234
|
+
|
235
235
|
def invitation_taken?
|
236
236
|
!invited_to_sign_up?
|
237
237
|
end
|
@@ -279,6 +279,23 @@ class InvitableTest < ActiveSupport::TestCase
|
|
279
279
|
refute_predicate user, :invited_to_sign_up?
|
280
280
|
end
|
281
281
|
|
282
|
+
test 'should not accept expired invitation while resetting the password' do
|
283
|
+
User.stubs(:invite_for).returns(1.day)
|
284
|
+
user = User.invite!(email: 'valid@email.com')
|
285
|
+
assert user.invited_to_sign_up?
|
286
|
+
user.invitation_created_at = Time.now.utc - 2.days
|
287
|
+
token, user.reset_password_token = Devise.token_generator.generate(User, :reset_password_token)
|
288
|
+
user.reset_password_sent_at = Time.now.utc
|
289
|
+
user.save
|
290
|
+
|
291
|
+
assert user.reset_password_token.present?
|
292
|
+
assert user.invitation_token.present?
|
293
|
+
User.reset_password_by_token(reset_password_token: token, password: '123456789', password_confirmation: '123456789')
|
294
|
+
assert_nil user.reload.reset_password_token
|
295
|
+
assert user.reload.invitation_token.present?
|
296
|
+
assert user.reload.invited_to_sign_up?
|
297
|
+
end
|
298
|
+
|
282
299
|
test 'should not accept invitation on failing to reset the password' do
|
283
300
|
user = User.invite!(email: 'valid@email.com')
|
284
301
|
assert user.invited_to_sign_up?
|
@@ -366,6 +383,42 @@ class InvitableTest < ActiveSupport::TestCase
|
|
366
383
|
User.validate_on_invite = validate_on_invite
|
367
384
|
end
|
368
385
|
|
386
|
+
test 'should not validate other attributes when validate_on_invite is disabled (for instance method)' do
|
387
|
+
validate_on_invite = User.validate_on_invite
|
388
|
+
User.validate_on_invite = false
|
389
|
+
user = new_user(email: 'valid@email.com', username: 'a' * 50)
|
390
|
+
user.invite!(nil, validate: false)
|
391
|
+
assert_empty user.errors
|
392
|
+
User.validate_on_invite = validate_on_invite
|
393
|
+
end
|
394
|
+
|
395
|
+
test 'should validate other attributes when validate_on_invite is disabled and validate option is enabled (for instance method)' do
|
396
|
+
validate_on_invite = User.validate_on_invite
|
397
|
+
User.validate_on_invite = false
|
398
|
+
user = new_user(email: 'valid@email.com', username: 'a' * 50)
|
399
|
+
user.invite!(nil, validate: true)
|
400
|
+
refute_empty user.errors[:username]
|
401
|
+
User.validate_on_invite = validate_on_invite
|
402
|
+
end
|
403
|
+
|
404
|
+
test 'should validate other attributes when validate_on_invite is enabled and validate option is disabled (for instance method)' do
|
405
|
+
validate_on_invite = User.validate_on_invite
|
406
|
+
User.validate_on_invite = true
|
407
|
+
user = new_user(email: 'valid@email.com', username: 'a' * 50)
|
408
|
+
user.invite!
|
409
|
+
refute_empty user.errors[:username]
|
410
|
+
User.validate_on_invite = validate_on_invite
|
411
|
+
end
|
412
|
+
|
413
|
+
test 'should validate other attributes when validate_on_invite is enabled and validate option is disabled explicitly (for instance method)' do
|
414
|
+
validate_on_invite = User.validate_on_invite
|
415
|
+
User.validate_on_invite = true
|
416
|
+
user = new_user(email: 'valid@email.com', username: 'a' * 50)
|
417
|
+
user.invite!(nil, validate: false)
|
418
|
+
assert_empty user.errors
|
419
|
+
User.validate_on_invite = validate_on_invite
|
420
|
+
end
|
421
|
+
|
369
422
|
test 'should return a record with errors if user was found by e-mail' do
|
370
423
|
existing_user = User.new(email: 'valid@email.com')
|
371
424
|
existing_user.save(validate: false)
|
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.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Cambra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- config/locales/et.yml
|
79
79
|
- config/locales/fa.yml
|
80
80
|
- config/locales/fr.yml
|
81
|
+
- config/locales/id.yml
|
81
82
|
- config/locales/it.yml
|
82
83
|
- config/locales/ja.yml
|
83
84
|
- config/locales/ko.yml
|