plutonium 0.12.13 → 0.13.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/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
|
@@ -5,19 +5,22 @@ module Plutonium
|
|
|
5
5
|
module FormHelper
|
|
6
6
|
include ActionView::Helpers::FormHelper
|
|
7
7
|
|
|
8
|
-
def resource_form_for(record, options
|
|
9
|
-
options[:
|
|
10
|
-
options
|
|
11
|
-
options[:html] ||= {}
|
|
12
|
-
unless options[:html].key?(:novalidate)
|
|
13
|
-
options[:html][:novalidate] = false
|
|
14
|
-
end
|
|
8
|
+
def resource_form_for(record, **options, &block)
|
|
9
|
+
options[:url] ||= resource_url_for(record, action: record.new_record? ? :create : :update)
|
|
10
|
+
options = build_form_options(options)
|
|
15
11
|
|
|
16
12
|
with_resource_form_field_error_proc do
|
|
17
13
|
form_for(record, options, &block)
|
|
18
14
|
end
|
|
19
15
|
end
|
|
20
16
|
|
|
17
|
+
def resource_form_with(**options, &block)
|
|
18
|
+
options = build_form_options(options)
|
|
19
|
+
with_resource_form_field_error_proc do
|
|
20
|
+
form_with(**options, &block)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
21
24
|
def token_tag(...)
|
|
22
25
|
# needed to workaround https://github.com/tailwindlabs/tailwindcss/issues/3350
|
|
23
26
|
super(...).sub(" />", " hidden />").html_safe
|
|
@@ -25,6 +28,14 @@ module Plutonium
|
|
|
25
28
|
|
|
26
29
|
private
|
|
27
30
|
|
|
31
|
+
def build_form_options(options)
|
|
32
|
+
options[:builder] ||= PlutoniumUi::FormBuilder
|
|
33
|
+
options[:wrapper] ||= :default_resource_form
|
|
34
|
+
options[:html] ||= {}
|
|
35
|
+
options[:html][:novalidate] = false unless options[:html].key?(:novalidate)
|
|
36
|
+
options
|
|
37
|
+
end
|
|
38
|
+
|
|
28
39
|
def with_resource_form_field_error_proc
|
|
29
40
|
# borrowed from https://github.com/heartcombo/simple_form/blob/main/lib/simple_form/action_view_extensions/form_helper.rb#L40C1-L50C10
|
|
30
41
|
# this does not look threadsafe
|
data/lib/plutonium/pkg/app.rb
CHANGED
|
@@ -7,6 +7,7 @@ module Plutonium
|
|
|
7
7
|
helper Plutonium::Helpers::ApplicationHelper
|
|
8
8
|
helper Plutonium::Helpers::ComponentHelper
|
|
9
9
|
helper Plutonium::Helpers::AssetsHelper
|
|
10
|
+
helper Plutonium::Helpers::FormHelper
|
|
10
11
|
|
|
11
12
|
layout "rodauth"
|
|
12
13
|
append_view_path File.expand_path("app/views", Plutonium.root)
|
data/lib/plutonium/version.rb
CHANGED
data/lib/plutonium.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "zeitwerk"
|
|
2
2
|
|
|
3
|
+
# Zeitwerk loader setup for the Plutonium gem
|
|
3
4
|
loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
|
|
4
5
|
loader.ignore("#{__dir__}/generators")
|
|
5
6
|
loader.ignore("#{__dir__}/plutonium/railtie.rb")
|
|
@@ -9,37 +10,47 @@ loader.setup
|
|
|
9
10
|
require_relative "plutonium/railtie" if defined?(Rails::Railtie)
|
|
10
11
|
|
|
11
12
|
module Plutonium
|
|
13
|
+
# Custom error class for the Plutonium module
|
|
12
14
|
class Error < StandardError; end
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
Pathname
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
16
|
+
class << self
|
|
17
|
+
# @return [Pathname] the root directory of the gem
|
|
18
|
+
def root
|
|
19
|
+
Pathname.new(File.expand_path("..", __dir__))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @return [Pathname] the root directory of the lib folder of the gem
|
|
23
|
+
def lib_root
|
|
24
|
+
root.join("lib", "plutonium")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @return [Logger] the Rails logger
|
|
28
|
+
def logger
|
|
29
|
+
Rails.logger
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @return [String] the name of the application
|
|
33
|
+
def application_name
|
|
34
|
+
@application_name || Rails.application.class.module_parent_name
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @param [String] application_name the name of the application
|
|
38
|
+
# @return [void]
|
|
39
|
+
attr_writer :application_name
|
|
40
|
+
|
|
41
|
+
# @return [Boolean] whether the gem is in development mode
|
|
42
|
+
def development?
|
|
43
|
+
ActiveModel::Type::Boolean.new.cast(ENV["PLUTONIUM_DEV"]).present?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Eager loads Rails application if not already eager loaded
|
|
47
|
+
# @return [void]
|
|
48
|
+
def eager_load_rails!
|
|
49
|
+
return if Rails.env.production? && defined?(@rails_eager_loaded)
|
|
50
|
+
|
|
51
|
+
Rails.application.eager_load! unless Rails.application.config.eager_load
|
|
52
|
+
@rails_eager_loaded = true
|
|
53
|
+
end
|
|
43
54
|
end
|
|
44
55
|
end
|
|
45
56
|
|
data/sig/plutonium.rbs
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
# plutonium.rbs
|
|
1
2
|
module Plutonium
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
class Error < StandardError; end
|
|
4
|
+
|
|
5
|
+
def self.root: () -> Pathname
|
|
6
|
+
def self.lib_root: () -> Pathname
|
|
7
|
+
def self.logger: () -> Logger
|
|
8
|
+
def self.application_name: () -> String
|
|
9
|
+
def self.application_name=: (String) -> void
|
|
10
|
+
def self.development?: () -> bool
|
|
11
|
+
def self.eager_load_rails!: () -> void
|
|
4
12
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: plutonium
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.13.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stefan Froelich
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-06-
|
|
11
|
+
date: 2024-06-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: zeitwerk
|
|
@@ -198,6 +198,118 @@ dependencies:
|
|
|
198
198
|
- - "~>"
|
|
199
199
|
- !ruby/object:Gem::Version
|
|
200
200
|
version: 0.23.1
|
|
201
|
+
- !ruby/object:Gem::Dependency
|
|
202
|
+
name: rake
|
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
|
204
|
+
requirements:
|
|
205
|
+
- - ">="
|
|
206
|
+
- !ruby/object:Gem::Version
|
|
207
|
+
version: '0'
|
|
208
|
+
type: :development
|
|
209
|
+
prerelease: false
|
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
211
|
+
requirements:
|
|
212
|
+
- - ">="
|
|
213
|
+
- !ruby/object:Gem::Version
|
|
214
|
+
version: '0'
|
|
215
|
+
- !ruby/object:Gem::Dependency
|
|
216
|
+
name: minitest
|
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
|
218
|
+
requirements:
|
|
219
|
+
- - ">="
|
|
220
|
+
- !ruby/object:Gem::Version
|
|
221
|
+
version: '0'
|
|
222
|
+
type: :development
|
|
223
|
+
prerelease: false
|
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
225
|
+
requirements:
|
|
226
|
+
- - ">="
|
|
227
|
+
- !ruby/object:Gem::Version
|
|
228
|
+
version: '0'
|
|
229
|
+
- !ruby/object:Gem::Dependency
|
|
230
|
+
name: minitest-reporters
|
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
|
232
|
+
requirements:
|
|
233
|
+
- - ">="
|
|
234
|
+
- !ruby/object:Gem::Version
|
|
235
|
+
version: '0'
|
|
236
|
+
type: :development
|
|
237
|
+
prerelease: false
|
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
239
|
+
requirements:
|
|
240
|
+
- - ">="
|
|
241
|
+
- !ruby/object:Gem::Version
|
|
242
|
+
version: '0'
|
|
243
|
+
- !ruby/object:Gem::Dependency
|
|
244
|
+
name: standard
|
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
|
246
|
+
requirements:
|
|
247
|
+
- - ">="
|
|
248
|
+
- !ruby/object:Gem::Version
|
|
249
|
+
version: '0'
|
|
250
|
+
type: :development
|
|
251
|
+
prerelease: false
|
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
253
|
+
requirements:
|
|
254
|
+
- - ">="
|
|
255
|
+
- !ruby/object:Gem::Version
|
|
256
|
+
version: '0'
|
|
257
|
+
- !ruby/object:Gem::Dependency
|
|
258
|
+
name: brakeman
|
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
|
260
|
+
requirements:
|
|
261
|
+
- - ">="
|
|
262
|
+
- !ruby/object:Gem::Version
|
|
263
|
+
version: '0'
|
|
264
|
+
type: :development
|
|
265
|
+
prerelease: false
|
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
267
|
+
requirements:
|
|
268
|
+
- - ">="
|
|
269
|
+
- !ruby/object:Gem::Version
|
|
270
|
+
version: '0'
|
|
271
|
+
- !ruby/object:Gem::Dependency
|
|
272
|
+
name: bundle-audit
|
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
|
274
|
+
requirements:
|
|
275
|
+
- - ">="
|
|
276
|
+
- !ruby/object:Gem::Version
|
|
277
|
+
version: '0'
|
|
278
|
+
type: :development
|
|
279
|
+
prerelease: false
|
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
281
|
+
requirements:
|
|
282
|
+
- - ">="
|
|
283
|
+
- !ruby/object:Gem::Version
|
|
284
|
+
version: '0'
|
|
285
|
+
- !ruby/object:Gem::Dependency
|
|
286
|
+
name: appraisal
|
|
287
|
+
requirement: !ruby/object:Gem::Requirement
|
|
288
|
+
requirements:
|
|
289
|
+
- - ">="
|
|
290
|
+
- !ruby/object:Gem::Version
|
|
291
|
+
version: '0'
|
|
292
|
+
type: :development
|
|
293
|
+
prerelease: false
|
|
294
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
295
|
+
requirements:
|
|
296
|
+
- - ">="
|
|
297
|
+
- !ruby/object:Gem::Version
|
|
298
|
+
version: '0'
|
|
299
|
+
- !ruby/object:Gem::Dependency
|
|
300
|
+
name: combustion
|
|
301
|
+
requirement: !ruby/object:Gem::Requirement
|
|
302
|
+
requirements:
|
|
303
|
+
- - ">="
|
|
304
|
+
- !ruby/object:Gem::Version
|
|
305
|
+
version: '0'
|
|
306
|
+
type: :development
|
|
307
|
+
prerelease: false
|
|
308
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
309
|
+
requirements:
|
|
310
|
+
- - ">="
|
|
311
|
+
- !ruby/object:Gem::Version
|
|
312
|
+
version: '0'
|
|
201
313
|
description: Plutonium extends Rails' capabilities with a powerful, generator-driven
|
|
202
314
|
toolkit designed to supercharge your development process. It transforms the way
|
|
203
315
|
you build applications with Rails, optimizing for rapid application development.
|
|
@@ -216,6 +328,7 @@ files:
|
|
|
216
328
|
- ".vscode/extensions.json"
|
|
217
329
|
- ".vscode/launch.json"
|
|
218
330
|
- ".vscode/settings.json"
|
|
331
|
+
- Appraisals
|
|
219
332
|
- CHANGELOG.md
|
|
220
333
|
- LICENSE.txt
|
|
221
334
|
- README copy.md
|
|
@@ -844,12 +957,15 @@ files:
|
|
|
844
957
|
- app/views/rodauth/webauthn_remove.html.erb
|
|
845
958
|
- app/views/rodauth/webauthn_setup.html.erb
|
|
846
959
|
- brakeman.ignore
|
|
960
|
+
- config.ru
|
|
847
961
|
- config/initializers/hotwire_turbo_monkey_patches.rb
|
|
848
962
|
- config/initializers/pagy.rb
|
|
849
963
|
- config/initializers/rabl.rb
|
|
850
964
|
- config/initializers/simple_form.rb
|
|
851
965
|
- esbuild.config.js
|
|
852
966
|
- exe/pug
|
|
967
|
+
- gemfiles/rails_7.gemfile
|
|
968
|
+
- gemfiles/rails_7.gemfile.lock
|
|
853
969
|
- lib/active_model/validations/array_validator.rb
|
|
854
970
|
- lib/active_model/validations/attached_validator.rb
|
|
855
971
|
- lib/active_model/validations/url_validator.rb
|
|
@@ -972,25 +1088,6 @@ files:
|
|
|
972
1088
|
- lib/generators/pu/rodauth/migration/active_record/verify_account.erb
|
|
973
1089
|
- lib/generators/pu/rodauth/migration/active_record/verify_login_change.erb
|
|
974
1090
|
- lib/generators/pu/rodauth/migration/active_record/webauthn.erb
|
|
975
|
-
- lib/generators/pu/rodauth/migration/sequel/account_expiration.erb
|
|
976
|
-
- lib/generators/pu/rodauth/migration/sequel/active_sessions.erb
|
|
977
|
-
- lib/generators/pu/rodauth/migration/sequel/audit_logging.erb
|
|
978
|
-
- lib/generators/pu/rodauth/migration/sequel/base.erb
|
|
979
|
-
- lib/generators/pu/rodauth/migration/sequel/disallow_password_reuse.erb
|
|
980
|
-
- lib/generators/pu/rodauth/migration/sequel/email_auth.erb
|
|
981
|
-
- lib/generators/pu/rodauth/migration/sequel/jwt_refresh.erb
|
|
982
|
-
- lib/generators/pu/rodauth/migration/sequel/lockout.erb
|
|
983
|
-
- lib/generators/pu/rodauth/migration/sequel/otp.erb
|
|
984
|
-
- lib/generators/pu/rodauth/migration/sequel/password_expiration.erb
|
|
985
|
-
- lib/generators/pu/rodauth/migration/sequel/recovery_codes.erb
|
|
986
|
-
- lib/generators/pu/rodauth/migration/sequel/remember.erb
|
|
987
|
-
- lib/generators/pu/rodauth/migration/sequel/reset_password.erb
|
|
988
|
-
- lib/generators/pu/rodauth/migration/sequel/separate_passwords.erb
|
|
989
|
-
- lib/generators/pu/rodauth/migration/sequel/single_session.erb
|
|
990
|
-
- lib/generators/pu/rodauth/migration/sequel/sms_codes.erb
|
|
991
|
-
- lib/generators/pu/rodauth/migration/sequel/verify_account.erb
|
|
992
|
-
- lib/generators/pu/rodauth/migration/sequel/verify_login_change.erb
|
|
993
|
-
- lib/generators/pu/rodauth/migration/sequel/webauthn.erb
|
|
994
1091
|
- lib/generators/pu/rodauth/migration_generator.rb
|
|
995
1092
|
- lib/generators/pu/rodauth/templates/INSTRUCTIONS
|
|
996
1093
|
- lib/generators/pu/rodauth/templates/app/controllers/plugin_controller.rb.tt
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Used by the account expiration feature
|
|
2
|
-
create_table :<%= table_prefix %>_activity_times do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
DateTime :last_activity_at, null: false
|
|
5
|
-
DateTime :last_login_at, null: false
|
|
6
|
-
DateTime :expired_at
|
|
7
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Used by the active sessions feature
|
|
2
|
-
create_table :<%= table_prefix %>_active_session_keys do
|
|
3
|
-
foreign_key :<%= table_prefix %>_id, :<%= table_prefix.pluralize %>, type: :Bignum
|
|
4
|
-
String :session_id
|
|
5
|
-
Time :created_at, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
6
|
-
Time :last_use, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
7
|
-
primary_key [:<%= table_prefix %>_id, :session_id]
|
|
8
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Used by the audit logging feature
|
|
2
|
-
create_table :<%= table_prefix %>_authentication_audit_logs do
|
|
3
|
-
primary_key :id, type: :Bignum
|
|
4
|
-
foreign_key :<%= table_prefix %>_id, :<%= table_prefix.pluralize %>, null: false, type: :Bignum
|
|
5
|
-
DateTime :at, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
6
|
-
String :message, null: false
|
|
7
|
-
<% case db.database_type -%>
|
|
8
|
-
<% when :postgres -%>
|
|
9
|
-
jsonb :metadata
|
|
10
|
-
<% when :sqlite, :mysql -%>
|
|
11
|
-
json :metadata
|
|
12
|
-
<% else -%>
|
|
13
|
-
String :metadata
|
|
14
|
-
<% end -%>
|
|
15
|
-
index [:<%= table_prefix %>_id, :at], name: :<%= table_prefix %>_audit_<%= table_prefix %>_at_idx
|
|
16
|
-
index :at, name: :<%= table_prefix %>_audit_at_idx
|
|
17
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<% if db.database_type == :postgres -%>
|
|
2
|
-
begin
|
|
3
|
-
run "CREATE EXTENSION IF NOT EXISTS citext"
|
|
4
|
-
rescue NoMethodError # migration is being reverted
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
<% end -%>
|
|
8
|
-
create_table :<%= table_prefix.pluralize %> do
|
|
9
|
-
primary_key :id, type: :Bignum
|
|
10
|
-
<% if db.database_type == :postgres -%>
|
|
11
|
-
citext :email, null: false
|
|
12
|
-
constraint :valid_email, email: /^[^,;@ \r\n]+@[^,@; \r\n]+\.[^,@; \r\n]+$/
|
|
13
|
-
<% else -%>
|
|
14
|
-
String :email, null: false
|
|
15
|
-
<% end -%>
|
|
16
|
-
Integer :status, null: false, default: 1
|
|
17
|
-
<% if db.supports_partial_indexes? -%>
|
|
18
|
-
index :email, unique: true, where: { status: [1, 2] }
|
|
19
|
-
<% else -%>
|
|
20
|
-
index :email, unique: true
|
|
21
|
-
<% end -%>
|
|
22
|
-
<% unless separate_passwords? -%>
|
|
23
|
-
String :password_hash
|
|
24
|
-
<% end -%>
|
|
25
|
-
end
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Used by the disallow password reuse feature
|
|
2
|
-
create_table :<%= table_prefix %>_previous_password_hashes do
|
|
3
|
-
primary_key :id, type: :Bignum
|
|
4
|
-
foreign_key :<%= table_prefix %>_id, :<%= table_prefix.pluralize %>, type: :Bignum
|
|
5
|
-
String :password_hash, null: false
|
|
6
|
-
end
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Used by the email auth feature
|
|
2
|
-
create_table :<%= table_prefix %>_email_auth_keys do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :key, null: false
|
|
5
|
-
DateTime :deadline, null: false
|
|
6
|
-
DateTime :email_last_sent, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
7
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Used by the jwt refresh feature
|
|
2
|
-
create_table :<%= table_prefix %>_jwt_refresh_keys do
|
|
3
|
-
primary_key :id, type: :Bignum
|
|
4
|
-
foreign_key :<%= table_prefix %>_id, :<%= table_prefix.pluralize %>, null: false, type: :Bignum
|
|
5
|
-
String :key, null: false
|
|
6
|
-
DateTime :deadline, null: false
|
|
7
|
-
index :<%= table_prefix %>_id, name: :<%= table_prefix %>_jwt_rk_<%= table_prefix %>_id_idx
|
|
8
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# Used by the lockout feature
|
|
2
|
-
create_table :<%= table_prefix %>_login_failures do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
Integer :number, null: false, default: 1
|
|
5
|
-
end
|
|
6
|
-
create_table :<%= table_prefix %>_lockouts do
|
|
7
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
8
|
-
String :key, null: false
|
|
9
|
-
DateTime :deadline, null: false
|
|
10
|
-
DateTime :email_last_sent
|
|
11
|
-
end
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Used by the otp feature
|
|
2
|
-
create_table :<%= table_prefix %>_otp_keys do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :key, null: false
|
|
5
|
-
Integer :num_failures, null: false, default: 0
|
|
6
|
-
Time :last_use, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
7
|
-
end
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Used by the password reset feature
|
|
2
|
-
create_table :<%= table_prefix %>_password_reset_keys do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :key, null: false
|
|
5
|
-
DateTime :deadline, null: false
|
|
6
|
-
DateTime :email_last_sent, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
7
|
-
end
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Stores password hashes separate from the account table
|
|
2
|
-
create_table :<%= table_prefix %>_password_hashes do
|
|
3
|
-
primary_key :id, type: :Bignum
|
|
4
|
-
foreign_key :<%= table_prefix %>_id, :<%= table_prefix.pluralize %>, type: :Bignum
|
|
5
|
-
String :password_hash, null: false
|
|
6
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Used by the sms codes feature
|
|
2
|
-
create_table :<%= table_prefix %>_sms_codes do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :phone_number, null: false
|
|
5
|
-
Integer :num_failures
|
|
6
|
-
String :code
|
|
7
|
-
DateTime :code_issued_at, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
8
|
-
end
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Used by the account verification feature
|
|
2
|
-
create_table :<%= table_prefix %>_verification_keys do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :key, null: false
|
|
5
|
-
DateTime :requested_at, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
6
|
-
DateTime :email_last_sent, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
7
|
-
end
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Used by the verify login change feature
|
|
2
|
-
create_table :<%= table_prefix %>_login_change_keys do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :key, null: false
|
|
5
|
-
String :login, null: false
|
|
6
|
-
DateTime :deadline, null: false
|
|
7
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Used by the webauthn feature
|
|
2
|
-
create_table :<%= table_prefix %>_webauthn_user_ids do
|
|
3
|
-
foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
|
|
4
|
-
String :webauthn_id, null: false
|
|
5
|
-
end
|
|
6
|
-
create_table :<%= table_prefix %>_webauthn_keys do
|
|
7
|
-
foreign_key :<%= table_prefix %>_id, :<%= table_prefix.pluralize %>, type: :Bignum
|
|
8
|
-
String :webauthn_id
|
|
9
|
-
String :public_key, null: false
|
|
10
|
-
Integer :sign_count, null: false
|
|
11
|
-
Time :last_use, null: false, default: Sequel::CURRENT_TIMESTAMP
|
|
12
|
-
primary_key [:<%= table_prefix %>_id, :webauthn_id]
|
|
13
|
-
end
|