rodauth 2.34.0 → 2.35.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96f5711d9bb49c87385e4e0ef0f07e0e8624e1139f145429c1a518d844811757
4
- data.tar.gz: 01c43ee8ceb8d4c61c040e3463bf8b03cdd239e2c401461ef0122a24407ce311
3
+ metadata.gz: f2b961b8668976f18f46df1c499c1c8f101e75a76527feef460419ad71d7d15b
4
+ data.tar.gz: 446184720914538cd207b90cb0d6b9e484eadb12559be84f117532aed5d1cf87
5
5
  SHA512:
6
- metadata.gz: 9b66e0f290cf4ae0c6d14c4032ff0830ef4b229a158def47247bec420414161dcfe35c60de12b15f20ac358d9c55d7ed446bf1d07cb0b6302031b63e5ce4b5a2
7
- data.tar.gz: 304d17a7a183a0e33e42db2fcb5be6e9cdab0b58a70416ac2abd49478c4a1cc28c62395bd25f0e5b154a8117e712772045994c72159f4d36b3413d5f567c5a2c
6
+ metadata.gz: 548c5f50659441297116a0343d2cf2160a8f54ec7c0f7b87867e6377bf9165a53db9b69802f2573343031a26c073ef3e4d0e4358163a97686511b32448f05f5f
7
+ data.tar.gz: bf33b84dcb33a6f5cb54f4df2f4561d57d74cc91040032d3eee58e72dbdedad618b726daff2341e91f4350a451b816f719c836f6211acfe20ffaecb879e736d5
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ === 2.35.0 (2025-05-28)
2
+
3
+ * Handle internal_request_configuration blocks in superclasses (jeremyevans, bjeanes)
4
+
5
+ * Avoid unused block warning on Ruby 3.4 (jeremyevans)
6
+
7
+ * Add throw_rodauth_error method to make it possible to throw without setting a field error (jf) (#418)
8
+
9
+ * Support logging out all active sessions for a loaded account that is not logged in (such as after resetting password) (enescakir) (#401)
10
+
1
11
  === 2.34.0 (2024-03-22)
2
12
 
3
13
  * Add remove_all_active_sessions_except_current method for removing current active session (jeremyevans) (#395)
data/README.rdoc CHANGED
@@ -338,10 +338,10 @@ PostgreSQL sets up new tables in the public schema by default.
338
338
  If you would like to use separate schemas per user, you can do:
339
339
 
340
340
  psql -U postgres -c "DROP SCHEMA public;" ${DATABASE_NAME}
341
- psql -U postgres -c "CREATE SCHEMA ${DATABASE_NAME} AUTHORIZATION ${DATABASE_NAME};" ${DATABASE_NAME}
342
- psql -U postgres -c "CREATE SCHEMA ${DATABASE_NAME}_password AUTHORIZATION ${DATABASE_NAME}_password;" ${DATABASE_NAME}
343
- psql -U postgres -c "GRANT USAGE ON SCHEMA ${DATABASE_NAME} TO ${DATABASE_NAME}_password;" ${DATABASE_NAME}
344
- psql -U postgres -c "GRANT USAGE ON SCHEMA ${DATABASE_NAME}_password TO ${DATABASE_NAME};" ${DATABASE_NAME}
341
+ psql -U postgres -c "CREATE SCHEMA AUTHORIZATION ${DATABASE_NAME};" ${DATABASE_NAME}
342
+ psql -U postgres -c "CREATE SCHEMA AUTHORIZATION ${DATABASE_NAME}_password;" ${DATABASE_NAME}
343
+ psql -U postgres -c "GRANT USAGE ON SCHEMA ${DATABASE_NAME} TO ${DATABASE_NAME}_password;" ${DATABASE_NAME}
344
+ psql -U postgres -c "GRANT USAGE ON SCHEMA ${DATABASE_NAME}_password TO ${DATABASE_NAME};" ${DATABASE_NAME}
345
345
 
346
346
  You'll need to modify the code to load the extension to specify the schema:
347
347
 
@@ -1,6 +1,6 @@
1
1
  = Render confirmation view
2
2
 
3
- Most Rodauth actions redirect and display a flash notice after they're succesfully performed. However, in some cases you may wish to render a view confirming that the action was succesful, for nicer user experience.
3
+ Most Rodauth actions redirect and display a flash notice after they're successfully performed. However, in some cases you may wish to render a view confirming that the action was successful, for nicer user experience.
4
4
 
5
5
  For example, when the user creates an account, you might render a page with a call to action to verify their account. Assuming you've created an +account_created+ view template alongside your other Rodauth templates, you can configure the following:
6
6
 
data/doc/login.rdoc CHANGED
@@ -14,9 +14,8 @@ location.
14
14
 
15
15
  login_additional_form_tags :: HTML fragment containing additional form tags to use on the login form.
16
16
  login_button :: The text to use for the login button.
17
- login_error_flash :: The flash error to show for an unsuccesful login.
17
+ login_error_flash :: The flash error to show for an unsuccessful login.
18
18
  login_error_status :: The response status to use when using an invalid login or password to login, 401 by default.
19
- login_form_footer :: A message to display after the login form.
20
19
  login_form_footer_links :: An array of entries for links to show on the login page. Each entry is an array of three elements, sort order (integer), link href, and link text.
21
20
  login_form_footer_links_heading :: A heading to show before the login form footer links.
22
21
  login_notice_flash :: The flash notice to show after successful login.
@@ -33,6 +32,7 @@ use_multi_phase_login? :: Whether to ask for login first, and only ask for passw
33
32
  == Auth Methods
34
33
 
35
34
  before_login_route :: Run arbitrary code before handling a login route.
35
+ login_form_footer :: A message to display after the login form.
36
36
  login_response :: Return a response after a successful login. By default, redirects to +login_redirect+ (or the requested location if +login_return_to_requested_location?+ is true).
37
37
  login_return_to_requested_location_path :: If +login_return_to_requested_location?+ is true, the path to use as the requested location. By default, uses the full path of the request for GET requests, and is nil for non-GET requests (in which case the default +login_redirect+ will be used).
38
38
  login_view :: The HTML to use for the login form.
@@ -0,0 +1,22 @@
1
+ = New Features
2
+
3
+ * A throw_rodauth_error method has been added to make it easier
4
+ for external extensions to throw the expected error value without
5
+ setting a field error.
6
+
7
+ = Improvements
8
+
9
+ * If an account is not currently logged in, but Rodauth knows the
10
+ related account id, remove_all_active_sessions and related
11
+ methods in the active_sessions plugin will now remove sessions
12
+ for the related account.
13
+
14
+ * When using the internal_request feature and subclasses,
15
+ internal_request_configuration blocks in superclasses are now
16
+ respected when creating the internal request class for a
17
+ subclass. When creating the internal request in the subclass,
18
+ this behaves as if all internal_request_configuration blocks
19
+ were specified directly in the subclass.
20
+
21
+ * An ignored block warning on Ruby 3.4 is now avoided by having
22
+ Rodauth.load_dependencies accept a block.
@@ -198,7 +198,7 @@ module Rodauth
198
198
 
199
199
  def active_sessions_ds
200
200
  db[active_sessions_table].
201
- where(active_sessions_account_id_column=>session_value)
201
+ where(active_sessions_account_id_column=>session_value || account_id)
202
202
  end
203
203
 
204
204
  def use_date_arithmetic?
@@ -643,9 +643,13 @@ module Rodauth
643
643
  set_response_error_status(status)
644
644
  end
645
645
 
646
+ def throw_rodauth_error
647
+ throw :rodauth_error
648
+ end
649
+
646
650
  def throw_error(field, error)
647
651
  set_field_error(field, error)
648
- throw :rodauth_error
652
+ throw_rodauth_error
649
653
  end
650
654
 
651
655
  def throw_error_status(status, field, error)
@@ -384,16 +384,26 @@ module Rodauth
384
384
 
385
385
  return if is_a?(InternalRequestMethods)
386
386
 
387
+ superklasses = []
388
+ superklass = self.class
389
+ until superklass == Rodauth::Auth
390
+ superklasses << superklass
391
+ superklass = superklass.superclass
392
+ end
393
+
387
394
  klass = self.class
388
395
  internal_class = Class.new(klass)
389
396
  internal_class.instance_variable_set(:@configuration_name, klass.configuration_name)
397
+ configuration = internal_class.configuration
390
398
 
391
- if blocks = klass.instance_variable_get(:@internal_request_configuration_blocks)
392
- configuration = internal_class.configuration
393
- blocks.each do |block|
394
- configuration.instance_exec(&block)
399
+ superklasses.reverse_each do |superklass|
400
+ if blocks = superklass.instance_variable_get(:@internal_request_configuration_blocks)
401
+ blocks.each do |block|
402
+ configuration.instance_exec(&block)
403
+ end
395
404
  end
396
405
  end
406
+
397
407
  internal_class.send(:extend, InternalRequestClassMethods)
398
408
  internal_class.send(:include, InternalRequestMethods)
399
409
  internal_class.allocate.post_configure
@@ -6,7 +6,7 @@ module Rodauth
6
6
  MAJOR = 2
7
7
 
8
8
  # The minor version of Rodauth, updated for new feature releases of Rodauth.
9
- MINOR = 34
9
+ MINOR = 35
10
10
 
11
11
  # The patch version of Rodauth, updated only for bug fixes from the last
12
12
  # feature release.
data/lib/rodauth.rb CHANGED
@@ -14,7 +14,7 @@ module Rodauth
14
14
  c.rodauth
15
15
  end
16
16
 
17
- def self.load_dependencies(app, opts={})
17
+ def self.load_dependencies(app, opts={}, &_)
18
18
  json_opt = opts.fetch(:json, app.opts[:rodauth_json])
19
19
  if json_opt
20
20
  app.plugin :json
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.34.0
4
+ version: 2.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-22 00:00:00.000000000 Z
11
+ date: 2024-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -352,6 +352,7 @@ extra_rdoc_files:
352
352
  - doc/release_notes/2.32.0.txt
353
353
  - doc/release_notes/2.33.0.txt
354
354
  - doc/release_notes/2.34.0.txt
355
+ - doc/release_notes/2.35.0.txt
355
356
  - doc/release_notes/2.4.0.txt
356
357
  - doc/release_notes/2.5.0.txt
357
358
  - doc/release_notes/2.6.0.txt
@@ -474,6 +475,7 @@ files:
474
475
  - doc/release_notes/2.32.0.txt
475
476
  - doc/release_notes/2.33.0.txt
476
477
  - doc/release_notes/2.34.0.txt
478
+ - doc/release_notes/2.35.0.txt
477
479
  - doc/release_notes/2.4.0.txt
478
480
  - doc/release_notes/2.5.0.txt
479
481
  - doc/release_notes/2.6.0.txt
@@ -634,7 +636,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
634
636
  - !ruby/object:Gem::Version
635
637
  version: '0'
636
638
  requirements: []
637
- rubygems_version: 3.5.3
639
+ rubygems_version: 3.5.9
638
640
  signing_key:
639
641
  specification_version: 4
640
642
  summary: Authentication and Account Management Framework for Rack Applications