plutonium 0.12.13 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +11 -0
- data/README.md +4 -0
- data/Rakefile +9 -5
- data/app/assets/plutonium.css +1 -1
- data/app/views/application/_flash.html.erb +1 -1
- data/app/views/application/_flash_toasts.html.erb +1 -1
- data/app/views/application/_resource_sidebar.html.erb +1 -1
- data/app/views/components/form/form_component.html.erb +1 -2
- data/app/views/components/interactive_action_form/interactive_action_form_component.html.erb +1 -1
- data/app/views/components/resource_header/resource_header_component.html.erb +3 -3
- data/app/views/components/resource_header/resource_header_component.rb +1 -1
- data/app/views/components/sidebar/sidebar_component.html.erb +1 -6
- data/app/views/components/sidebar/sidebar_component.rb +11 -3
- data/app/views/layouts/resource.html.erb +1 -1
- data/app/views/layouts/rodauth.html.erb +7 -8
- data/app/views/resource/_interactive_resource_action_form.html.erb +4 -4
- data/app/views/rodauth/_email_auth_request_form.html.erb +2 -2
- data/app/views/rodauth/_login_form.html.erb +24 -18
- data/app/views/rodauth/_login_form_footer.html.erb +1 -1
- data/app/views/rodauth/change_login.html.erb +20 -11
- data/app/views/rodauth/change_password.html.erb +11 -11
- data/app/views/rodauth/close_account.html.erb +4 -4
- data/app/views/rodauth/create_account.html.erb +44 -18
- data/app/views/rodauth/email_auth.html.erb +2 -2
- data/app/views/rodauth/login.html.erb +3 -5
- data/app/views/rodauth/logout.html.erb +7 -4
- data/app/views/rodauth/otp_auth.html.erb +5 -6
- data/app/views/rodauth/otp_disable.html.erb +4 -5
- data/app/views/rodauth/otp_setup.html.erb +8 -8
- data/app/views/rodauth/recovery_auth.html.erb +5 -5
- data/app/views/rodauth/recovery_codes.html.erb +5 -5
- data/app/views/rodauth/remember.html.erb +2 -2
- data/app/views/rodauth/reset_password.html.erb +8 -8
- data/app/views/rodauth/reset_password_request.html.erb +14 -10
- data/app/views/rodauth/sms_auth.html.erb +4 -4
- data/app/views/rodauth/sms_confirm.html.erb +4 -4
- data/app/views/rodauth/sms_disable.html.erb +5 -5
- data/app/views/rodauth/sms_request.html.erb +2 -2
- data/app/views/rodauth/sms_setup.html.erb +7 -7
- data/app/views/rodauth/two_factor_disable.html.erb +4 -4
- data/app/views/rodauth/unlock_account.html.erb +8 -10
- data/app/views/rodauth/unlock_account_request.html.erb +5 -7
- data/app/views/rodauth/verify_account.html.erb +8 -8
- data/app/views/rodauth/verify_account_resend.html.erb +13 -10
- data/app/views/rodauth/verify_login_change.html.erb +2 -2
- data/app/views/rodauth/webauthn_auth.html.erb +2 -2
- data/app/views/rodauth/webauthn_remove.html.erb +5 -5
- data/app/views/rodauth/webauthn_setup.html.erb +5 -5
- data/config.ru +9 -0
- data/gemfiles/rails_7.gemfile +13 -0
- data/gemfiles/rails_7.gemfile.lock +335 -0
- data/lib/generators/pu/rodauth/install_generator.rb +0 -5
- data/lib/generators/pu/rodauth/migration/active_record/audit_logging.erb +2 -2
- data/lib/generators/pu/rodauth/migration_generator.rb +30 -51
- data/lib/generators/pu/rodauth/templates/app/mailers/rodauth_mailer.rb.tt +1 -0
- data/lib/generators/pu/rodauth/templates/app/models/account.rb.tt +0 -8
- data/lib/generators/pu/rodauth/templates/app/rodauth/rodauth_plugin.rb.tt +8 -2
- data/lib/generators/pu/rodauth/templates/db/migrate/create_rodauth.rb.tt +0 -8
- data/lib/plutonium/auth/rodauth.rb +3 -1
- data/lib/plutonium/core/controllers/base.rb +29 -19
- data/lib/plutonium/core/fields/inputs/date_time_input.rb +1 -1
- data/lib/plutonium/helpers/display_helper.rb +6 -4
- data/lib/plutonium/helpers/form_helper.rb +18 -7
- data/lib/plutonium/pkg/app.rb +4 -0
- data/lib/plutonium/rodauth/controller_methods.rb +1 -0
- data/lib/plutonium/version.rb +1 -1
- data/lib/plutonium.rb +40 -29
- data/sig/plutonium.rbs +10 -2
- metadata +118 -21
- data/lib/generators/pu/rodauth/migration/sequel/account_expiration.erb +0 -7
- data/lib/generators/pu/rodauth/migration/sequel/active_sessions.erb +0 -8
- data/lib/generators/pu/rodauth/migration/sequel/audit_logging.erb +0 -17
- data/lib/generators/pu/rodauth/migration/sequel/base.erb +0 -25
- data/lib/generators/pu/rodauth/migration/sequel/disallow_password_reuse.erb +0 -6
- data/lib/generators/pu/rodauth/migration/sequel/email_auth.erb +0 -7
- data/lib/generators/pu/rodauth/migration/sequel/jwt_refresh.erb +0 -8
- data/lib/generators/pu/rodauth/migration/sequel/lockout.erb +0 -11
- data/lib/generators/pu/rodauth/migration/sequel/otp.erb +0 -7
- data/lib/generators/pu/rodauth/migration/sequel/password_expiration.erb +0 -5
- data/lib/generators/pu/rodauth/migration/sequel/recovery_codes.erb +0 -6
- data/lib/generators/pu/rodauth/migration/sequel/remember.erb +0 -6
- data/lib/generators/pu/rodauth/migration/sequel/reset_password.erb +0 -7
- data/lib/generators/pu/rodauth/migration/sequel/separate_passwords.erb +0 -6
- data/lib/generators/pu/rodauth/migration/sequel/single_session.erb +0 -5
- data/lib/generators/pu/rodauth/migration/sequel/sms_codes.erb +0 -8
- data/lib/generators/pu/rodauth/migration/sequel/verify_account.erb +0 -7
- data/lib/generators/pu/rodauth/migration/sequel/verify_login_change.erb +0 -7
- data/lib/generators/pu/rodauth/migration/sequel/webauthn.erb +0 -13
@@ -0,0 +1,335 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
plutonium (0.12.13)
|
5
|
+
active_interaction (~> 5.3)
|
6
|
+
dry-initializer (~> 3.1)
|
7
|
+
listen (~> 3.8)
|
8
|
+
pagy (~> 7.0)
|
9
|
+
pundit (~> 2.3)
|
10
|
+
rabl (~> 0.16.1)
|
11
|
+
rails (>= 7.1, < 8.0)
|
12
|
+
semantic_range (~> 3.0)
|
13
|
+
simple_form (~> 5.3)
|
14
|
+
tty-prompt (~> 0.23.1)
|
15
|
+
view_component (~> 3)
|
16
|
+
view_component-form (~> 0.2.6)
|
17
|
+
zeitwerk
|
18
|
+
|
19
|
+
GEM
|
20
|
+
remote: https://rubygems.org/
|
21
|
+
specs:
|
22
|
+
actioncable (7.1.3.4)
|
23
|
+
actionpack (= 7.1.3.4)
|
24
|
+
activesupport (= 7.1.3.4)
|
25
|
+
nio4r (~> 2.0)
|
26
|
+
websocket-driver (>= 0.6.1)
|
27
|
+
zeitwerk (~> 2.6)
|
28
|
+
actionmailbox (7.1.3.4)
|
29
|
+
actionpack (= 7.1.3.4)
|
30
|
+
activejob (= 7.1.3.4)
|
31
|
+
activerecord (= 7.1.3.4)
|
32
|
+
activestorage (= 7.1.3.4)
|
33
|
+
activesupport (= 7.1.3.4)
|
34
|
+
mail (>= 2.7.1)
|
35
|
+
net-imap
|
36
|
+
net-pop
|
37
|
+
net-smtp
|
38
|
+
actionmailer (7.1.3.4)
|
39
|
+
actionpack (= 7.1.3.4)
|
40
|
+
actionview (= 7.1.3.4)
|
41
|
+
activejob (= 7.1.3.4)
|
42
|
+
activesupport (= 7.1.3.4)
|
43
|
+
mail (~> 2.5, >= 2.5.4)
|
44
|
+
net-imap
|
45
|
+
net-pop
|
46
|
+
net-smtp
|
47
|
+
rails-dom-testing (~> 2.2)
|
48
|
+
actionpack (7.1.3.4)
|
49
|
+
actionview (= 7.1.3.4)
|
50
|
+
activesupport (= 7.1.3.4)
|
51
|
+
nokogiri (>= 1.8.5)
|
52
|
+
racc
|
53
|
+
rack (>= 2.2.4)
|
54
|
+
rack-session (>= 1.0.1)
|
55
|
+
rack-test (>= 0.6.3)
|
56
|
+
rails-dom-testing (~> 2.2)
|
57
|
+
rails-html-sanitizer (~> 1.6)
|
58
|
+
actiontext (7.1.3.4)
|
59
|
+
actionpack (= 7.1.3.4)
|
60
|
+
activerecord (= 7.1.3.4)
|
61
|
+
activestorage (= 7.1.3.4)
|
62
|
+
activesupport (= 7.1.3.4)
|
63
|
+
globalid (>= 0.6.0)
|
64
|
+
nokogiri (>= 1.8.5)
|
65
|
+
actionview (7.1.3.4)
|
66
|
+
activesupport (= 7.1.3.4)
|
67
|
+
builder (~> 3.1)
|
68
|
+
erubi (~> 1.11)
|
69
|
+
rails-dom-testing (~> 2.2)
|
70
|
+
rails-html-sanitizer (~> 1.6)
|
71
|
+
active_interaction (5.3.0)
|
72
|
+
activemodel (>= 5.2, < 8)
|
73
|
+
activesupport (>= 5.2, < 8)
|
74
|
+
activejob (7.1.3.4)
|
75
|
+
activesupport (= 7.1.3.4)
|
76
|
+
globalid (>= 0.3.6)
|
77
|
+
activemodel (7.1.3.4)
|
78
|
+
activesupport (= 7.1.3.4)
|
79
|
+
activerecord (7.1.3.4)
|
80
|
+
activemodel (= 7.1.3.4)
|
81
|
+
activesupport (= 7.1.3.4)
|
82
|
+
timeout (>= 0.4.0)
|
83
|
+
activestorage (7.1.3.4)
|
84
|
+
actionpack (= 7.1.3.4)
|
85
|
+
activejob (= 7.1.3.4)
|
86
|
+
activerecord (= 7.1.3.4)
|
87
|
+
activesupport (= 7.1.3.4)
|
88
|
+
marcel (~> 1.0)
|
89
|
+
activesupport (7.1.3.4)
|
90
|
+
base64
|
91
|
+
bigdecimal
|
92
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
93
|
+
connection_pool (>= 2.2.5)
|
94
|
+
drb
|
95
|
+
i18n (>= 1.6, < 2)
|
96
|
+
minitest (>= 5.1)
|
97
|
+
mutex_m
|
98
|
+
tzinfo (~> 2.0)
|
99
|
+
ansi (1.5.0)
|
100
|
+
appraisal (2.5.0)
|
101
|
+
bundler
|
102
|
+
rake
|
103
|
+
thor (>= 0.14.0)
|
104
|
+
ast (2.4.2)
|
105
|
+
base64 (0.2.0)
|
106
|
+
bigdecimal (3.1.8)
|
107
|
+
brakeman (6.1.2)
|
108
|
+
racc
|
109
|
+
builder (3.3.0)
|
110
|
+
bundle-audit (0.1.0)
|
111
|
+
bundler-audit
|
112
|
+
bundler-audit (0.9.1)
|
113
|
+
bundler (>= 1.2.0, < 3)
|
114
|
+
thor (~> 1.0)
|
115
|
+
combustion (1.4.0)
|
116
|
+
activesupport (>= 3.0.0)
|
117
|
+
railties (>= 3.0.0)
|
118
|
+
thor (>= 0.14.6)
|
119
|
+
concurrent-ruby (1.3.3)
|
120
|
+
connection_pool (2.4.1)
|
121
|
+
crass (1.0.6)
|
122
|
+
date (3.3.4)
|
123
|
+
drb (2.2.1)
|
124
|
+
dry-initializer (3.1.1)
|
125
|
+
erubi (1.12.0)
|
126
|
+
ffi (1.17.0-x86_64-darwin)
|
127
|
+
globalid (1.2.1)
|
128
|
+
activesupport (>= 6.1)
|
129
|
+
i18n (1.14.5)
|
130
|
+
concurrent-ruby (~> 1.0)
|
131
|
+
importmap-rails (2.0.1)
|
132
|
+
actionpack (>= 6.0.0)
|
133
|
+
activesupport (>= 6.0.0)
|
134
|
+
railties (>= 6.0.0)
|
135
|
+
io-console (0.7.2)
|
136
|
+
irb (1.13.1)
|
137
|
+
rdoc (>= 4.0.0)
|
138
|
+
reline (>= 0.4.2)
|
139
|
+
json (2.7.2)
|
140
|
+
language_server-protocol (3.17.0.3)
|
141
|
+
lint_roller (1.1.0)
|
142
|
+
listen (3.9.0)
|
143
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
144
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
145
|
+
loofah (2.22.0)
|
146
|
+
crass (~> 1.0.2)
|
147
|
+
nokogiri (>= 1.12.0)
|
148
|
+
mail (2.8.1)
|
149
|
+
mini_mime (>= 0.1.1)
|
150
|
+
net-imap
|
151
|
+
net-pop
|
152
|
+
net-smtp
|
153
|
+
marcel (1.0.4)
|
154
|
+
method_source (1.1.0)
|
155
|
+
mini_mime (1.1.5)
|
156
|
+
minitest (5.23.1)
|
157
|
+
minitest-reporters (1.6.1)
|
158
|
+
ansi
|
159
|
+
builder
|
160
|
+
minitest (>= 5.0)
|
161
|
+
ruby-progressbar
|
162
|
+
mutex_m (0.2.0)
|
163
|
+
net-imap (0.4.12)
|
164
|
+
date
|
165
|
+
net-protocol
|
166
|
+
net-pop (0.1.2)
|
167
|
+
net-protocol
|
168
|
+
net-protocol (0.2.2)
|
169
|
+
timeout
|
170
|
+
net-smtp (0.5.0)
|
171
|
+
net-protocol
|
172
|
+
nio4r (2.7.3)
|
173
|
+
nokogiri (1.16.5-x86_64-darwin)
|
174
|
+
racc (~> 1.4)
|
175
|
+
pagy (7.0.11)
|
176
|
+
parallel (1.25.1)
|
177
|
+
parser (3.3.2.0)
|
178
|
+
ast (~> 2.4.1)
|
179
|
+
racc
|
180
|
+
pastel (0.8.0)
|
181
|
+
tty-color (~> 0.5)
|
182
|
+
psych (5.1.2)
|
183
|
+
stringio
|
184
|
+
puma (6.4.2)
|
185
|
+
nio4r (~> 2.0)
|
186
|
+
pundit (2.3.2)
|
187
|
+
activesupport (>= 3.0.0)
|
188
|
+
rabl (0.16.1)
|
189
|
+
activesupport (>= 2.3.14)
|
190
|
+
racc (1.8.0)
|
191
|
+
rack (3.1.3)
|
192
|
+
rack-session (2.0.0)
|
193
|
+
rack (>= 3.0.0)
|
194
|
+
rack-test (2.1.0)
|
195
|
+
rack (>= 1.3)
|
196
|
+
rackup (2.1.0)
|
197
|
+
rack (>= 3)
|
198
|
+
webrick (~> 1.8)
|
199
|
+
rails (7.1.3.4)
|
200
|
+
actioncable (= 7.1.3.4)
|
201
|
+
actionmailbox (= 7.1.3.4)
|
202
|
+
actionmailer (= 7.1.3.4)
|
203
|
+
actionpack (= 7.1.3.4)
|
204
|
+
actiontext (= 7.1.3.4)
|
205
|
+
actionview (= 7.1.3.4)
|
206
|
+
activejob (= 7.1.3.4)
|
207
|
+
activemodel (= 7.1.3.4)
|
208
|
+
activerecord (= 7.1.3.4)
|
209
|
+
activestorage (= 7.1.3.4)
|
210
|
+
activesupport (= 7.1.3.4)
|
211
|
+
bundler (>= 1.15.0)
|
212
|
+
railties (= 7.1.3.4)
|
213
|
+
rails-dom-testing (2.2.0)
|
214
|
+
activesupport (>= 5.0.0)
|
215
|
+
minitest
|
216
|
+
nokogiri (>= 1.6)
|
217
|
+
rails-html-sanitizer (1.6.0)
|
218
|
+
loofah (~> 2.21)
|
219
|
+
nokogiri (~> 1.14)
|
220
|
+
railties (7.1.3.4)
|
221
|
+
actionpack (= 7.1.3.4)
|
222
|
+
activesupport (= 7.1.3.4)
|
223
|
+
irb
|
224
|
+
rackup (>= 1.0.0)
|
225
|
+
rake (>= 12.2)
|
226
|
+
thor (~> 1.0, >= 1.2.2)
|
227
|
+
zeitwerk (~> 2.6)
|
228
|
+
rainbow (3.1.1)
|
229
|
+
rake (13.2.1)
|
230
|
+
rb-fsevent (0.11.2)
|
231
|
+
rb-inotify (0.11.1)
|
232
|
+
ffi (~> 1.0)
|
233
|
+
rdoc (6.7.0)
|
234
|
+
psych (>= 4.0.0)
|
235
|
+
regexp_parser (2.9.2)
|
236
|
+
reline (0.5.9)
|
237
|
+
io-console (~> 0.5)
|
238
|
+
rexml (3.3.0)
|
239
|
+
strscan
|
240
|
+
rubocop (1.63.5)
|
241
|
+
json (~> 2.3)
|
242
|
+
language_server-protocol (>= 3.17.0)
|
243
|
+
parallel (~> 1.10)
|
244
|
+
parser (>= 3.3.0.2)
|
245
|
+
rainbow (>= 2.2.2, < 4.0)
|
246
|
+
regexp_parser (>= 1.8, < 3.0)
|
247
|
+
rexml (>= 3.2.5, < 4.0)
|
248
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
249
|
+
ruby-progressbar (~> 1.7)
|
250
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
251
|
+
rubocop-ast (1.31.3)
|
252
|
+
parser (>= 3.3.1.0)
|
253
|
+
rubocop-performance (1.21.0)
|
254
|
+
rubocop (>= 1.48.1, < 2.0)
|
255
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
256
|
+
ruby-progressbar (1.13.0)
|
257
|
+
semantic_range (3.0.0)
|
258
|
+
simple_form (5.3.1)
|
259
|
+
actionpack (>= 5.2)
|
260
|
+
activemodel (>= 5.2)
|
261
|
+
sqlite3 (1.7.3-x86_64-darwin)
|
262
|
+
standard (1.36.0)
|
263
|
+
language_server-protocol (~> 3.17.0.2)
|
264
|
+
lint_roller (~> 1.0)
|
265
|
+
rubocop (~> 1.63.0)
|
266
|
+
standard-custom (~> 1.0.0)
|
267
|
+
standard-performance (~> 1.4)
|
268
|
+
standard-custom (1.0.2)
|
269
|
+
lint_roller (~> 1.0)
|
270
|
+
rubocop (~> 1.50)
|
271
|
+
standard-performance (1.4.0)
|
272
|
+
lint_roller (~> 1.1)
|
273
|
+
rubocop-performance (~> 1.21.0)
|
274
|
+
stimulus-rails (1.3.3)
|
275
|
+
railties (>= 6.0.0)
|
276
|
+
stringio (3.1.0)
|
277
|
+
strscan (3.1.0)
|
278
|
+
thor (1.3.1)
|
279
|
+
timeout (0.4.1)
|
280
|
+
tty-color (0.6.0)
|
281
|
+
tty-cursor (0.7.1)
|
282
|
+
tty-prompt (0.23.1)
|
283
|
+
pastel (~> 0.8)
|
284
|
+
tty-reader (~> 0.8)
|
285
|
+
tty-reader (0.9.0)
|
286
|
+
tty-cursor (~> 0.7)
|
287
|
+
tty-screen (~> 0.8)
|
288
|
+
wisper (~> 2.0)
|
289
|
+
tty-screen (0.8.2)
|
290
|
+
turbo-rails (2.0.5)
|
291
|
+
actionpack (>= 6.0.0)
|
292
|
+
activejob (>= 6.0.0)
|
293
|
+
railties (>= 6.0.0)
|
294
|
+
tzinfo (2.0.6)
|
295
|
+
concurrent-ruby (~> 1.0)
|
296
|
+
unicode-display_width (2.5.0)
|
297
|
+
view_component (3.12.1)
|
298
|
+
activesupport (>= 5.2.0, < 8.0)
|
299
|
+
concurrent-ruby (~> 1.0)
|
300
|
+
method_source (~> 1.0)
|
301
|
+
view_component-form (0.2.6)
|
302
|
+
actionview (>= 6.0.0, < 7.2)
|
303
|
+
activesupport (>= 6.0.0, < 7.2)
|
304
|
+
view_component (>= 2.34.0, < 4.0)
|
305
|
+
zeitwerk (~> 2.5)
|
306
|
+
webrick (1.8.1)
|
307
|
+
websocket-driver (0.7.6)
|
308
|
+
websocket-extensions (>= 0.1.0)
|
309
|
+
websocket-extensions (0.1.5)
|
310
|
+
wisper (2.0.1)
|
311
|
+
zeitwerk (2.6.15)
|
312
|
+
|
313
|
+
PLATFORMS
|
314
|
+
x86_64-darwin
|
315
|
+
|
316
|
+
DEPENDENCIES
|
317
|
+
appraisal
|
318
|
+
brakeman
|
319
|
+
bundle-audit
|
320
|
+
combustion
|
321
|
+
importmap-rails
|
322
|
+
minitest
|
323
|
+
minitest-reporters
|
324
|
+
plutonium!
|
325
|
+
puma (>= 5.0)
|
326
|
+
rails (~> 7.1.3, >= 7.1.3.4)
|
327
|
+
rake
|
328
|
+
sqlite3 (~> 1.4)
|
329
|
+
standard
|
330
|
+
stimulus-rails
|
331
|
+
turbo-rails
|
332
|
+
tzinfo-data
|
333
|
+
|
334
|
+
BUNDLED WITH
|
335
|
+
2.5.6
|
@@ -61,11 +61,6 @@ module Pu
|
|
61
61
|
|
62
62
|
private
|
63
63
|
|
64
|
-
def sequel_activerecord_integration?
|
65
|
-
defined?(ActiveRecord::Railtie) &&
|
66
|
-
(!defined?(Sequel) || Sequel::DATABASES.empty?)
|
67
|
-
end
|
68
|
-
|
69
64
|
def sequel_adapter
|
70
65
|
SEQUEL_ADAPTERS[activerecord_adapter] || activerecord_adapter
|
71
66
|
end
|
@@ -11,6 +11,6 @@ create_table :<%= table_prefix %>_authentication_audit_logs<%= primary_key_type
|
|
11
11
|
<% else -%>
|
12
12
|
t.string :metadata
|
13
13
|
<% end -%>
|
14
|
-
t.index [:<%= table_prefix %>_id, :at], name: "audit_<%= table_prefix %>
|
15
|
-
t.index :at, name: "
|
14
|
+
t.index [:<%= table_prefix %>_id, :at], name: "audit_<%= table_prefix %>_<%= table_prefix %>_id_at_idx"
|
15
|
+
t.index :at, name: "audit_<%= table_prefix %>_at_idx"
|
16
16
|
end
|
@@ -11,9 +11,12 @@ require "#{__dir__}/concerns/account_selector"
|
|
11
11
|
module Pu
|
12
12
|
module Rodauth
|
13
13
|
class MigrationGenerator < ::Rails::Generators::Base
|
14
|
+
include ::ActiveRecord::Generators::Migration
|
14
15
|
include Concerns::Configuration
|
15
16
|
include Concerns::AccountSelector
|
16
17
|
|
18
|
+
MIGRATION_DIR = "#{__dir__}/migration/active_record"
|
19
|
+
|
17
20
|
source_root "#{__dir__}/templates"
|
18
21
|
|
19
22
|
desc "Generate migrations for supported features\n\n" \
|
@@ -124,63 +127,39 @@ module Pu
|
|
124
127
|
Dir["#{MIGRATION_DIR}/*.erb"].map { |filename| File.basename(filename, ".erb").to_sym }
|
125
128
|
end
|
126
129
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
def activerecord_adapter
|
133
|
-
if ActiveRecord::Base.respond_to?(:connection_db_config)
|
134
|
-
ActiveRecord::Base.connection_db_config.adapter
|
135
|
-
else
|
136
|
-
ActiveRecord::Base.connection_config.fetch(:adapter)
|
137
|
-
end
|
130
|
+
def activerecord_adapter
|
131
|
+
if ActiveRecord::Base.respond_to?(:connection_db_config)
|
132
|
+
ActiveRecord::Base.connection_db_config.adapter
|
133
|
+
else
|
134
|
+
ActiveRecord::Base.connection_config.fetch(:adapter)
|
138
135
|
end
|
136
|
+
end
|
139
137
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
def default_primary_key_type
|
151
|
-
if ActiveRecord.version >= Gem::Version.new("5.1")
|
152
|
-
:bigint
|
153
|
-
else
|
154
|
-
:integer
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
# Active Record 7+ sets default precision to 6 for timestamp columns,
|
159
|
-
# so we need to ensure we match this when setting the default value.
|
160
|
-
def current_timestamp
|
161
|
-
if ActiveRecord.version >= Gem::Version.new("7.0") && ["mysql2", "trilogy"].include?(activerecord_adapter) && ActiveRecord::Base.connection.supports_datetime_with_precision?
|
162
|
-
"CURRENT_TIMESTAMP(6)"
|
163
|
-
else
|
164
|
-
"CURRENT_TIMESTAMP"
|
165
|
-
end
|
166
|
-
end
|
167
|
-
else # Sequel
|
168
|
-
include ::Rails::Generators::Migration
|
169
|
-
|
170
|
-
MIGRATION_DIR = "#{__dir__}/migration/sequel"
|
171
|
-
|
172
|
-
def self.next_migration_number(dirname)
|
173
|
-
next_migration_number = current_migration_number(dirname) + 1
|
174
|
-
[Time.now.utc.strftime("%Y%m%d%H%M%S"), format("%.14d", next_migration_number)].max
|
138
|
+
def primary_key_type(key = :id)
|
139
|
+
generators = ::Rails.application.config.generators
|
140
|
+
column_type = generators.options[:active_record][:primary_key_type]
|
141
|
+
if key
|
142
|
+
", #{key}: :#{column_type}" if column_type
|
143
|
+
else
|
144
|
+
column_type || default_primary_key_type
|
175
145
|
end
|
146
|
+
end
|
176
147
|
|
177
|
-
|
178
|
-
|
148
|
+
def default_primary_key_type
|
149
|
+
if ActiveRecord.version >= Gem::Version.new("5.1")
|
150
|
+
:bigint
|
151
|
+
else
|
152
|
+
:integer
|
179
153
|
end
|
154
|
+
end
|
180
155
|
|
181
|
-
|
182
|
-
|
183
|
-
|
156
|
+
# Active Record 7+ sets default precision to 6 for timestamp columns,
|
157
|
+
# so we need to ensure we match this when setting the default value.
|
158
|
+
def current_timestamp
|
159
|
+
if ActiveRecord.version >= Gem::Version.new("7.0") && ["mysql2", "trilogy"].include?(activerecord_adapter) && ActiveRecord::Base.connection.supports_datetime_with_precision?
|
160
|
+
"CURRENT_TIMESTAMP(6)"
|
161
|
+
else
|
162
|
+
"CURRENT_TIMESTAMP"
|
184
163
|
end
|
185
164
|
end
|
186
165
|
end
|
@@ -55,6 +55,7 @@ class RodauthMailer < ApplicationMailer
|
|
55
55
|
|
56
56
|
def rodauth(name, account_id, &block)
|
57
57
|
instance = RodauthApp.rodauth(name).allocate
|
58
|
+
instance.url_options = default_url_options
|
58
59
|
instance.instance_eval { @account = account_ds(account_id).first! }
|
59
60
|
instance.instance_eval(&block) if block
|
60
61
|
instance
|
@@ -1,4 +1,3 @@
|
|
1
|
-
<% if defined?(ActiveRecord::Railtie) -%>
|
2
1
|
class <%= account_path.classify %> < ResourceRecord
|
3
2
|
include Rodauth::Rails.model<%= "(:#{table_prefix})" unless primary? %>
|
4
3
|
# add concerns above.
|
@@ -30,10 +29,3 @@ class <%= account_path.classify %> < ResourceRecord
|
|
30
29
|
|
31
30
|
# add methods above.
|
32
31
|
end
|
33
|
-
<% else -%>
|
34
|
-
class <%= table_prefix.camelize %> < Sequel::Model
|
35
|
-
include Rodauth::Rails.model
|
36
|
-
plugin :enum
|
37
|
-
enum :status, unverified: 1, verified: 2, closed: 3
|
38
|
-
end
|
39
|
-
<% end -%>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "sequel/core"
|
2
2
|
|
3
3
|
class RodauthPlugin < Rodauth::Rails::Auth
|
4
|
+
attr_accessor :url_options
|
5
|
+
|
4
6
|
configure do
|
5
7
|
# ==> Features
|
6
8
|
# See the Rodauth documentation for the list of available config options:
|
@@ -14,7 +16,6 @@ class RodauthPlugin < Rodauth::Rails::Auth
|
|
14
16
|
|
15
17
|
# ==> General
|
16
18
|
|
17
|
-
<% if sequel_activerecord_integration? -%>
|
18
19
|
# Initialize Sequel and have it reuse Active Record's database connection.
|
19
20
|
<% if RUBY_ENGINE == "jruby" -%>
|
20
21
|
db Sequel.connect("jdbc:<%= sequel_adapter %>://", extensions: :activerecord_connection, keep_reference: false)
|
@@ -26,7 +27,6 @@ class RodauthPlugin < Rodauth::Rails::Auth
|
|
26
27
|
# https://github.com/janko/rodauth-rails/issues/244
|
27
28
|
convert_token_id_to_integer? true
|
28
29
|
|
29
|
-
<% end -%>
|
30
30
|
# Change prefix of table and foreign key column names from default "account"
|
31
31
|
# accounts_table :users
|
32
32
|
# verify_account_table :user_verification_keys
|
@@ -228,4 +228,10 @@ class RodauthPlugin < Rodauth::Rails::Auth
|
|
228
228
|
# Does not work with only_json?
|
229
229
|
# remember_deadline_interval Hash[days: 30]
|
230
230
|
end
|
231
|
+
|
232
|
+
private
|
233
|
+
|
234
|
+
def rails_url_options
|
235
|
+
url_options || super
|
236
|
+
end
|
231
237
|
end
|
@@ -1,13 +1,5 @@
|
|
1
|
-
<% if defined?(::ActiveRecord::Railtie) -%>
|
2
1
|
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
3
2
|
def change
|
4
3
|
<%= migration_content -%>
|
5
4
|
end
|
6
5
|
end
|
7
|
-
<% else -%>
|
8
|
-
Sequel.migration do
|
9
|
-
change do
|
10
|
-
<%= migration_content -%>
|
11
|
-
end
|
12
|
-
end
|
13
|
-
<% end -%>
|
@@ -35,18 +35,18 @@ module Plutonium
|
|
35
35
|
end
|
36
36
|
|
37
37
|
#
|
38
|
-
# Returns a dynamic list of args to be used with `url_for
|
39
|
-
# The current entity and parent record (for nested routes) are inserted appropriately, ensuring that generated
|
38
|
+
# Returns a dynamic list of args to be used with `url_for`, which considers the route namespace and nesting.
|
39
|
+
# The current entity and parent record (for nested routes) are inserted appropriately, ensuring that generated URLs
|
40
40
|
# obey the current routing.
|
41
41
|
#
|
42
|
-
# e.g
|
42
|
+
# e.g., of route helpers that will be invoked given the output of this method
|
43
43
|
#
|
44
44
|
# - when invoked in a root route (/acme/dashboard/users)
|
45
45
|
#
|
46
46
|
# `resource_url_args_for User` => `entity_users_*`
|
47
47
|
# `resource_url_args_for @user` => `entity_user_*`
|
48
48
|
# `resource_url_args_for @user, action: :edit` => `edit_entity_user_*`
|
49
|
-
# `resource_url_args_for @user, Post
|
49
|
+
# `resource_url_args_for @user, Post` => `entity_user_posts_*`
|
50
50
|
#
|
51
51
|
# - when invoked in a nested route (/acme/dashboard/users/1/post/1)
|
52
52
|
#
|
@@ -55,26 +55,36 @@ module Plutonium
|
|
55
55
|
# `resource_url_args_for @post, action: :edit` => `edit_entity_user_post_*`
|
56
56
|
#
|
57
57
|
# @param [Class, ApplicationRecord] *args arguments you would normally pass to `url_for`
|
58
|
-
# @param [Symbol] action optional action to invoke e.g
|
58
|
+
# @param [Symbol] action optional action to invoke, e.g., :new, :edit
|
59
|
+
# @param [ApplicationRecord] parent the parent record for nested routes, if any
|
60
|
+
# @param [Hash] kwargs additional keyword arguments to pass to `url_for`
|
59
61
|
#
|
60
|
-
# @return [
|
62
|
+
# @return [Hash] args to pass to `url_for`
|
61
63
|
#
|
62
64
|
def resource_url_args_for(*args, action: nil, parent: nil, **kwargs)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
65
|
+
url_args = {**kwargs, action: action}.compact
|
66
|
+
|
67
|
+
controller_chain = [current_package.to_s]
|
68
|
+
[parent, *args].compact.each_with_index do |element, index|
|
69
|
+
if element.is_a?(Class)
|
70
|
+
controller_chain << element.to_s.pluralize
|
71
|
+
else
|
72
|
+
controller_chain << element.class.to_s.pluralize
|
73
|
+
if index == args.length - 1
|
74
|
+
url_args[:id] = element.to_param
|
75
|
+
url_args[:action] ||= :show
|
76
|
+
else
|
77
|
+
url_args[element.model_name.singular_route_key.to_sym] = element.to_param
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
url_args[:controller] = "/#{controller_chain.join("::").underscore}"
|
82
|
+
|
83
|
+
if scoped_to_entity? && scoped_entity_strategy == :path
|
84
|
+
url_args[scoped_entity_param_key] = current_scoped_entity
|
74
85
|
end
|
75
86
|
|
76
|
-
|
77
|
-
base_args + args + [**kwargs]
|
87
|
+
url_args
|
78
88
|
end
|
79
89
|
|
80
90
|
def resource_url_for(...)
|
@@ -47,10 +47,12 @@ module Plutonium
|
|
47
47
|
|
48
48
|
def display_association_value(association)
|
49
49
|
display_name = display_name_of(association)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
if registered_resources.include?(association.class)
|
51
|
+
link_to display_name, resource_url_for(association, parent: nil),
|
52
|
+
class: "font-medium text-primary-600 dark:text-primary-500"
|
53
|
+
else
|
54
|
+
display_name
|
55
|
+
end
|
54
56
|
end
|
55
57
|
|
56
58
|
def display_numeric_value(value)
|