plutonium 0.12.13 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +11 -0
  3. data/README.md +4 -0
  4. data/Rakefile +9 -5
  5. data/app/assets/plutonium.css +1 -1
  6. data/app/views/application/_flash.html.erb +1 -1
  7. data/app/views/application/_flash_toasts.html.erb +1 -1
  8. data/app/views/application/_resource_sidebar.html.erb +1 -1
  9. data/app/views/components/form/form_component.html.erb +1 -2
  10. data/app/views/components/interactive_action_form/interactive_action_form_component.html.erb +1 -1
  11. data/app/views/components/resource_header/resource_header_component.html.erb +3 -3
  12. data/app/views/components/resource_header/resource_header_component.rb +1 -1
  13. data/app/views/components/sidebar/sidebar_component.html.erb +1 -6
  14. data/app/views/components/sidebar/sidebar_component.rb +11 -3
  15. data/app/views/layouts/resource.html.erb +1 -1
  16. data/app/views/layouts/rodauth.html.erb +7 -8
  17. data/app/views/resource/_interactive_resource_action_form.html.erb +4 -4
  18. data/app/views/rodauth/_email_auth_request_form.html.erb +2 -2
  19. data/app/views/rodauth/_login_form.html.erb +24 -18
  20. data/app/views/rodauth/_login_form_footer.html.erb +1 -1
  21. data/app/views/rodauth/change_login.html.erb +20 -11
  22. data/app/views/rodauth/change_password.html.erb +11 -11
  23. data/app/views/rodauth/close_account.html.erb +4 -4
  24. data/app/views/rodauth/create_account.html.erb +44 -18
  25. data/app/views/rodauth/email_auth.html.erb +2 -2
  26. data/app/views/rodauth/login.html.erb +3 -5
  27. data/app/views/rodauth/logout.html.erb +7 -4
  28. data/app/views/rodauth/otp_auth.html.erb +5 -6
  29. data/app/views/rodauth/otp_disable.html.erb +4 -5
  30. data/app/views/rodauth/otp_setup.html.erb +8 -8
  31. data/app/views/rodauth/recovery_auth.html.erb +5 -5
  32. data/app/views/rodauth/recovery_codes.html.erb +5 -5
  33. data/app/views/rodauth/remember.html.erb +2 -2
  34. data/app/views/rodauth/reset_password.html.erb +8 -8
  35. data/app/views/rodauth/reset_password_request.html.erb +14 -10
  36. data/app/views/rodauth/sms_auth.html.erb +4 -4
  37. data/app/views/rodauth/sms_confirm.html.erb +4 -4
  38. data/app/views/rodauth/sms_disable.html.erb +5 -5
  39. data/app/views/rodauth/sms_request.html.erb +2 -2
  40. data/app/views/rodauth/sms_setup.html.erb +7 -7
  41. data/app/views/rodauth/two_factor_disable.html.erb +4 -4
  42. data/app/views/rodauth/unlock_account.html.erb +8 -10
  43. data/app/views/rodauth/unlock_account_request.html.erb +5 -7
  44. data/app/views/rodauth/verify_account.html.erb +8 -8
  45. data/app/views/rodauth/verify_account_resend.html.erb +13 -10
  46. data/app/views/rodauth/verify_login_change.html.erb +2 -2
  47. data/app/views/rodauth/webauthn_auth.html.erb +2 -2
  48. data/app/views/rodauth/webauthn_remove.html.erb +5 -5
  49. data/app/views/rodauth/webauthn_setup.html.erb +5 -5
  50. data/config.ru +9 -0
  51. data/gemfiles/rails_7.gemfile +13 -0
  52. data/gemfiles/rails_7.gemfile.lock +335 -0
  53. data/lib/generators/pu/rodauth/install_generator.rb +0 -5
  54. data/lib/generators/pu/rodauth/migration/active_record/audit_logging.erb +2 -2
  55. data/lib/generators/pu/rodauth/migration_generator.rb +30 -51
  56. data/lib/generators/pu/rodauth/templates/app/mailers/rodauth_mailer.rb.tt +1 -0
  57. data/lib/generators/pu/rodauth/templates/app/models/account.rb.tt +0 -8
  58. data/lib/generators/pu/rodauth/templates/app/rodauth/rodauth_plugin.rb.tt +8 -2
  59. data/lib/generators/pu/rodauth/templates/db/migrate/create_rodauth.rb.tt +0 -8
  60. data/lib/plutonium/auth/rodauth.rb +3 -1
  61. data/lib/plutonium/core/controllers/base.rb +29 -19
  62. data/lib/plutonium/core/fields/inputs/date_time_input.rb +1 -1
  63. data/lib/plutonium/helpers/display_helper.rb +6 -4
  64. data/lib/plutonium/helpers/form_helper.rb +18 -7
  65. data/lib/plutonium/pkg/app.rb +4 -0
  66. data/lib/plutonium/rodauth/controller_methods.rb +1 -0
  67. data/lib/plutonium/version.rb +1 -1
  68. data/lib/plutonium.rb +40 -29
  69. data/sig/plutonium.rbs +10 -2
  70. metadata +118 -21
  71. data/lib/generators/pu/rodauth/migration/sequel/account_expiration.erb +0 -7
  72. data/lib/generators/pu/rodauth/migration/sequel/active_sessions.erb +0 -8
  73. data/lib/generators/pu/rodauth/migration/sequel/audit_logging.erb +0 -17
  74. data/lib/generators/pu/rodauth/migration/sequel/base.erb +0 -25
  75. data/lib/generators/pu/rodauth/migration/sequel/disallow_password_reuse.erb +0 -6
  76. data/lib/generators/pu/rodauth/migration/sequel/email_auth.erb +0 -7
  77. data/lib/generators/pu/rodauth/migration/sequel/jwt_refresh.erb +0 -8
  78. data/lib/generators/pu/rodauth/migration/sequel/lockout.erb +0 -11
  79. data/lib/generators/pu/rodauth/migration/sequel/otp.erb +0 -7
  80. data/lib/generators/pu/rodauth/migration/sequel/password_expiration.erb +0 -5
  81. data/lib/generators/pu/rodauth/migration/sequel/recovery_codes.erb +0 -6
  82. data/lib/generators/pu/rodauth/migration/sequel/remember.erb +0 -6
  83. data/lib/generators/pu/rodauth/migration/sequel/reset_password.erb +0 -7
  84. data/lib/generators/pu/rodauth/migration/sequel/separate_passwords.erb +0 -6
  85. data/lib/generators/pu/rodauth/migration/sequel/single_session.erb +0 -5
  86. data/lib/generators/pu/rodauth/migration/sequel/sms_codes.erb +0 -8
  87. data/lib/generators/pu/rodauth/migration/sequel/verify_account.erb +0 -7
  88. data/lib/generators/pu/rodauth/migration/sequel/verify_login_change.erb +0 -7
  89. 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 = {}, &block)
9
- options[:builder] ||= PlutoniumUi::FormBuilder
10
- options[:wrapper] ||= :default_resource_form
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
@@ -56,6 +56,10 @@ module Plutonium
56
56
  end
57
57
  end
58
58
 
59
+ def dom_id
60
+ module_parent_name.underscore.dasherize
61
+ end
62
+
59
63
  private
60
64
 
61
65
  def draw_resource_routes_internal
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Plutonium
2
- VERSION = "0.12.13"
2
+ VERSION = "0.13.0"
3
3
  end
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
- def self.root
15
- Pathname.new File.expand_path("../", __dir__)
16
- end
17
-
18
- def self.lib_root
19
- root.join("lib", "plutonium")
20
- end
21
-
22
- def self.logger
23
- Rails.logger
24
- end
25
-
26
- def self.application_name
27
- @application_name || Rails.application.class.module_parent.name
28
- end
29
-
30
- def self.application_name=(application_name)
31
- @application_name = application_name
32
- end
33
-
34
- def self.development?
35
- ActiveModel::Type::Boolean.new.cast(ENV["PLUTONIUM_DEV"]).present?
36
- end
37
-
38
- def self.eager_load_rails!
39
- return if Rails.env.production? && defined?(@rails_eager_loaded)
40
-
41
- Rails.application.eager_load! unless Rails.application.config.eager_load
42
- @rails_eager_loaded = true
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
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
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.12.13
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-12 00:00:00.000000000 Z
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,5 +0,0 @@
1
- # Used by the password expiration feature
2
- create_table :<%= table_prefix %>_password_change_times do
3
- foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
4
- DateTime :changed_at, null: false, default: Sequel::CURRENT_TIMESTAMP
5
- end
@@ -1,6 +0,0 @@
1
- # Used by the recovery codes feature
2
- create_table :<%= table_prefix %>_recovery_codes do
3
- foreign_key :id, :<%= table_prefix.pluralize %>, type: :Bignum
4
- String :code
5
- primary_key [:id, :code]
6
- end
@@ -1,6 +0,0 @@
1
- # Used by the remember me feature
2
- create_table :<%= table_prefix %>_remember_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
- 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,5 +0,0 @@
1
- # Used by the single session feature
2
- create_table :<%= table_prefix %>_session_keys do
3
- foreign_key :id, :<%= table_prefix.pluralize %>, primary_key: true, type: :Bignum
4
- String :key, null: false
5
- 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