rodauth-model 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -1
- data/lib/rodauth/model/active_record.rb +8 -0
- data/lib/rodauth/model/sequel.rb +8 -0
- data/rodauth-model.gemspec +3 -3
- metadata +8 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aea9e15f1d5a320dba7b2e4cb959b9c8c4358146ac04a09c1bfb2e719a0fb826
|
4
|
+
data.tar.gz: 5765f24048e014d3cefd3b46bd82d08cdcc98ff0c2d362865fa2e6f17597b3f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cfe79f030285164d1f3fc36fb1be09a3ca067b282b633870af1a17b341fc9be836d1a93d983dbf211f8e78d9416cc0fd808465470b5256e8e4f9a1b31ed03e0
|
7
|
+
data.tar.gz: e6ce5e3c754233554c95609405e512ebcf53ce3a608701bc93ebadd63b9aca994404a25feda89669cf20082d9215710d4d6dcf8d958cff4faa82b4227ff00082
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -41,8 +41,12 @@ account.password_hash #=> "$2a$12$k/Ub1I2iomi84RacqY89Hu4.M0vK7klRnRtzorDyvOkVI.
|
|
41
41
|
account.password_hash #=> #<Account::PasswordHash...> (record from `account_password_hashes` table)
|
42
42
|
account.password_hash.password_hash #=> "$2a$12$k/Ub1..." (inaccessible when using database authentication functions)
|
43
43
|
|
44
|
+
# whether a password is set
|
45
|
+
account.password? #=> true
|
46
|
+
|
44
47
|
account.password = nil # clears password hash
|
45
48
|
account.password_hash #=> nil
|
49
|
+
account.password? #=> false
|
46
50
|
```
|
47
51
|
|
48
52
|
Note that the password attribute doesn't come with validations, making it unsuitable for forms. It was primarily intended to allow easily creating accounts in development console and in tests.
|
@@ -112,6 +116,7 @@ Below is a list of all associations defined depending on the features loaded:
|
|
112
116
|
| lockout | `:lockout` | `has_one` | `Lockout` | `account_lockouts` |
|
113
117
|
| lockout | `:login_failure` | `has_one` | `LoginFailure` | `account_login_failures` |
|
114
118
|
| otp | `:otp_key` | `has_one` | `OtpKey` | `account_otp_keys` |
|
119
|
+
| otp_unlock | `:otp_unlock` | `has_one` | `OtpUnlock` | `account_otp_unlocks` |
|
115
120
|
| password_expiration | `:password_change_time` | `has_one` | `PasswordChangeTime` | `account_password_change_times` |
|
116
121
|
| recovery_codes | `:recovery_codes` | `has_many` | `RecoveryCode` | `account_recovery_codes` |
|
117
122
|
| remember | `:remember_key` | `has_one` | `RememberKey` | `account_remember_keys` |
|
@@ -123,7 +128,8 @@ Below is a list of all associations defined depending on the features loaded:
|
|
123
128
|
| webauthn | `:webauthn_keys` | `has_many` | `WebauthnKey` | `account_webauthn_keys` |
|
124
129
|
| webauthn | `:webauthn_user_id` | `has_one` | `WebauthnUserId` | `account_webauthn_user_ids` |
|
125
130
|
|
126
|
-
|
131
|
+
> [!NOTE]
|
132
|
+
> Some Rodauth tables use composite primary keys, which are supported in Active Record 7.1+. If you're on an older version of Active Record, you might need to add the [composite_primary_keys] gem to your Gemfile. Sequel has always natively supported composite primary keys.
|
127
133
|
|
128
134
|
## Extending associations
|
129
135
|
|
@@ -32,6 +32,14 @@ module Rodauth
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
define_method(:password?) do
|
37
|
+
if rodauth.account_password_hash_column
|
38
|
+
!!public_send(rodauth.account_password_hash_column)
|
39
|
+
else
|
40
|
+
!!password_hash
|
41
|
+
end
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
45
|
def define_associations(model)
|
data/lib/rodauth/model/sequel.rb
CHANGED
@@ -42,6 +42,14 @@ module Rodauth
|
|
42
42
|
self.password_hash_attributes = attributes
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
define_method(:password?) do
|
47
|
+
if rodauth.account_password_hash_column
|
48
|
+
!!public_send(rodauth.account_password_hash_column)
|
49
|
+
else
|
50
|
+
!!password_hash
|
51
|
+
end
|
52
|
+
end
|
45
53
|
end
|
46
54
|
|
47
55
|
def define_associations(model)
|
data/rodauth-model.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "rodauth-model"
|
5
|
-
spec.version = "0.
|
5
|
+
spec.version = "0.4.0"
|
6
6
|
spec.authors = ["Janko Marohnić"]
|
7
7
|
spec.email = ["janko@hey.com"]
|
8
8
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.summary = spec.description
|
11
11
|
spec.homepage = "https://github.com/janko/rodauth-model"
|
12
12
|
spec.license = "MIT"
|
13
|
-
spec.required_ruby_version = ">= 2.
|
13
|
+
spec.required_ruby_version = ">= 2.5"
|
14
14
|
|
15
15
|
spec.metadata["source_code_uri"] = "https://github.com/janko/rodauth-model"
|
16
16
|
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "minitest"
|
23
23
|
spec.add_development_dependency "minitest-hooks"
|
24
24
|
spec.add_development_dependency "bcrypt"
|
25
|
-
spec.add_development_dependency "jwt"
|
25
|
+
spec.add_development_dependency "jwt", "< 2.10"
|
26
26
|
spec.add_development_dependency "rotp"
|
27
27
|
spec.add_development_dependency "rqrcode"
|
28
28
|
spec.add_development_dependency "webauthn" unless RUBY_ENGINE == "jruby"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-26 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rodauth
|
@@ -70,16 +69,16 @@ dependencies:
|
|
70
69
|
name: jwt
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
72
71
|
requirements:
|
73
|
-
- - "
|
72
|
+
- - "<"
|
74
73
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
74
|
+
version: '2.10'
|
76
75
|
type: :development
|
77
76
|
prerelease: false
|
78
77
|
version_requirements: !ruby/object:Gem::Requirement
|
79
78
|
requirements:
|
80
|
-
- - "
|
79
|
+
- - "<"
|
81
80
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
81
|
+
version: '2.10'
|
83
82
|
- !ruby/object:Gem::Dependency
|
84
83
|
name: rotp
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,7 +143,6 @@ licenses:
|
|
144
143
|
- MIT
|
145
144
|
metadata:
|
146
145
|
source_code_uri: https://github.com/janko/rodauth-model
|
147
|
-
post_install_message:
|
148
146
|
rdoc_options: []
|
149
147
|
require_paths:
|
150
148
|
- lib
|
@@ -152,15 +150,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
150
|
requirements:
|
153
151
|
- - ">="
|
154
152
|
- !ruby/object:Gem::Version
|
155
|
-
version: '2.
|
153
|
+
version: '2.5'
|
156
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
155
|
requirements:
|
158
156
|
- - ">="
|
159
157
|
- !ruby/object:Gem::Version
|
160
158
|
version: '0'
|
161
159
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
163
|
-
signing_key:
|
160
|
+
rubygems_version: 3.6.2
|
164
161
|
specification_version: 4
|
165
162
|
summary: Provides model mixin for Active Record and Sequel that defines password attribute
|
166
163
|
and associations based on Rodauth configuration.
|