aikotoba 0.2.0 → 0.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.
- checksums.yaml +4 -4
- data/README.md +346 -198
- data/app/controllers/aikotoba/accounts_controller.rb +6 -1
- data/app/controllers/aikotoba/application_controller.rb +7 -1
- data/app/controllers/aikotoba/confirms_controller.rb +2 -2
- data/app/controllers/aikotoba/magic_links_controller.rb +103 -0
- data/app/controllers/aikotoba/recoveries_controller.rb +2 -2
- data/app/controllers/aikotoba/sessions_controller.rb +2 -2
- data/app/controllers/aikotoba/unlocks_controller.rb +2 -2
- data/app/controllers/concerns/aikotoba/authenticatable.rb +1 -22
- data/app/controllers/concerns/aikotoba/protection/rate_limiting.rb +2 -11
- data/app/controllers/concerns/aikotoba/request_backable.rb +53 -0
- data/app/controllers/concerns/aikotoba/scopable.rb +5 -5
- data/app/mailers/aikotoba/account_mailer.rb +35 -3
- data/app/models/aikotoba/account/confirmation_token.rb +6 -1
- data/app/models/aikotoba/account/magic_link.rb +38 -0
- data/app/models/aikotoba/account/magic_link_token.rb +27 -0
- data/app/models/aikotoba/account/{password → password_hash}/argon2.rb +1 -1
- data/app/models/aikotoba/account/password_hash.rb +97 -0
- data/app/models/aikotoba/account/recovery.rb +27 -1
- data/app/models/aikotoba/account/recovery_token.rb +6 -1
- data/app/models/aikotoba/account/session.rb +5 -3
- data/app/models/aikotoba/account/unlock_token.rb +6 -1
- data/app/models/aikotoba/account.rb +80 -60
- data/app/models/concerns/aikotoba/enabled_feature_checkable.rb +8 -0
- data/app/models/concerns/aikotoba/optional_association.rb +82 -0
- data/app/models/concerns/aikotoba/token_encryptable.rb +1 -11
- data/app/views/aikotoba/account_mailer/magic_link.html.erb +3 -0
- data/app/views/aikotoba/magic_links/new.html.erb +14 -0
- data/app/views/aikotoba/sessions/_links.html.erb +6 -1
- data/config/locales/en.yml +10 -0
- data/config/routes.rb +25 -16
- data/db/migrate/20211204121532_create_aikotoba_accounts.rb +77 -33
- data/lib/aikotoba/configuration.rb +99 -0
- data/lib/aikotoba/constraints/magic_link_authenticatable_constraint.rb +7 -0
- data/lib/aikotoba/engine.rb +13 -0
- data/lib/aikotoba/errors.rb +2 -0
- data/lib/aikotoba/scope.rb +64 -0
- data/lib/aikotoba/scopes.rb +102 -0
- data/lib/aikotoba/test/authentication_helper.rb +4 -4
- data/lib/aikotoba/version.rb +1 -1
- data/lib/aikotoba.rb +33 -67
- metadata +16 -5
- data/app/models/aikotoba/account/password.rb +0 -34
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aikotoba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Madogiwa
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version:
|
|
18
|
+
version: '8.1'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version:
|
|
25
|
+
version: '8.1'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: argon2
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -49,12 +49,14 @@ files:
|
|
|
49
49
|
- app/controllers/aikotoba/accounts_controller.rb
|
|
50
50
|
- app/controllers/aikotoba/application_controller.rb
|
|
51
51
|
- app/controllers/aikotoba/confirms_controller.rb
|
|
52
|
+
- app/controllers/aikotoba/magic_links_controller.rb
|
|
52
53
|
- app/controllers/aikotoba/recoveries_controller.rb
|
|
53
54
|
- app/controllers/aikotoba/sessions_controller.rb
|
|
54
55
|
- app/controllers/aikotoba/unlocks_controller.rb
|
|
55
56
|
- app/controllers/concerns/aikotoba/authenticatable.rb
|
|
56
57
|
- app/controllers/concerns/aikotoba/protection/rate_limiting.rb
|
|
57
58
|
- app/controllers/concerns/aikotoba/protection/session_fixation_attack.rb
|
|
59
|
+
- app/controllers/concerns/aikotoba/request_backable.rb
|
|
58
60
|
- app/controllers/concerns/aikotoba/scopable.rb
|
|
59
61
|
- app/mailers/aikotoba/account_mailer.rb
|
|
60
62
|
- app/mailers/aikotoba/application_mailer.rb
|
|
@@ -62,22 +64,27 @@ files:
|
|
|
62
64
|
- app/models/aikotoba/account/confirmation.rb
|
|
63
65
|
- app/models/aikotoba/account/confirmation_token.rb
|
|
64
66
|
- app/models/aikotoba/account/lock.rb
|
|
65
|
-
- app/models/aikotoba/account/
|
|
66
|
-
- app/models/aikotoba/account/
|
|
67
|
+
- app/models/aikotoba/account/magic_link.rb
|
|
68
|
+
- app/models/aikotoba/account/magic_link_token.rb
|
|
69
|
+
- app/models/aikotoba/account/password_hash.rb
|
|
70
|
+
- app/models/aikotoba/account/password_hash/argon2.rb
|
|
67
71
|
- app/models/aikotoba/account/recovery.rb
|
|
68
72
|
- app/models/aikotoba/account/recovery_token.rb
|
|
69
73
|
- app/models/aikotoba/account/session.rb
|
|
70
74
|
- app/models/aikotoba/account/token.rb
|
|
71
75
|
- app/models/aikotoba/account/unlock_token.rb
|
|
72
76
|
- app/models/concerns/aikotoba/enabled_feature_checkable.rb
|
|
77
|
+
- app/models/concerns/aikotoba/optional_association.rb
|
|
73
78
|
- app/models/concerns/aikotoba/token_encryptable.rb
|
|
74
79
|
- app/views/aikotoba/account_mailer/confirm.html.erb
|
|
80
|
+
- app/views/aikotoba/account_mailer/magic_link.html.erb
|
|
75
81
|
- app/views/aikotoba/account_mailer/recover.html.erb
|
|
76
82
|
- app/views/aikotoba/account_mailer/unlock.html.erb
|
|
77
83
|
- app/views/aikotoba/accounts/new.html.erb
|
|
78
84
|
- app/views/aikotoba/common/_errors.html.erb
|
|
79
85
|
- app/views/aikotoba/common/_message.html.erb
|
|
80
86
|
- app/views/aikotoba/confirms/new.html.erb
|
|
87
|
+
- app/views/aikotoba/magic_links/new.html.erb
|
|
81
88
|
- app/views/aikotoba/recoveries/edit.html.erb
|
|
82
89
|
- app/views/aikotoba/recoveries/new.html.erb
|
|
83
90
|
- app/views/aikotoba/sessions/_links.html.erb
|
|
@@ -90,12 +97,16 @@ files:
|
|
|
90
97
|
- config/routes.rb
|
|
91
98
|
- db/migrate/20211204121532_create_aikotoba_accounts.rb
|
|
92
99
|
- lib/aikotoba.rb
|
|
100
|
+
- lib/aikotoba/configuration.rb
|
|
93
101
|
- lib/aikotoba/constraints/confirmable_constraint.rb
|
|
94
102
|
- lib/aikotoba/constraints/lockable_constraint.rb
|
|
103
|
+
- lib/aikotoba/constraints/magic_link_authenticatable_constraint.rb
|
|
95
104
|
- lib/aikotoba/constraints/recoverable_constraint.rb
|
|
96
105
|
- lib/aikotoba/constraints/registerable_constraint.rb
|
|
97
106
|
- lib/aikotoba/engine.rb
|
|
98
107
|
- lib/aikotoba/errors.rb
|
|
108
|
+
- lib/aikotoba/scope.rb
|
|
109
|
+
- lib/aikotoba/scopes.rb
|
|
99
110
|
- lib/aikotoba/test/authentication_helper.rb
|
|
100
111
|
- lib/aikotoba/version.rb
|
|
101
112
|
- lib/tasks/aikotoba_tasks.rake
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Aikotoba
|
|
4
|
-
class Account::Password
|
|
5
|
-
LENGTH_RANGE = Aikotoba.password_length_range
|
|
6
|
-
|
|
7
|
-
def initialize(
|
|
8
|
-
value:,
|
|
9
|
-
pepper: Aikotoba.password_pepper,
|
|
10
|
-
algorithm_class: Argon2
|
|
11
|
-
)
|
|
12
|
-
@value = value
|
|
13
|
-
@pepper = pepper
|
|
14
|
-
@algorithm = algorithm_class.new(password: password_with_pepper(@value))
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
attr_reader :value
|
|
18
|
-
|
|
19
|
-
def match?(digest:)
|
|
20
|
-
@algorithm.verify_password?(digest)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def digest
|
|
24
|
-
return "" if value.blank?
|
|
25
|
-
@algorithm.generate_hash
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
def password_with_pepper(password)
|
|
31
|
-
"#{password}-#{@pepper}"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|