rodauth 2.48.0 → 2.49.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: b9a5a66fe82750a982d493fd5e6558b4fef6f94f1761257b3242ff53014eb81b
4
- data.tar.gz: ecd3f766f3b4d96acd2c7e651d71d1ad0cbb4e60e49db3d5e396a304866b733f
3
+ metadata.gz: 24077da1fc384a74f6e692220eeac283243ce13c0d219befdbd43c4a3498ab63
4
+ data.tar.gz: b05d593e3e12ebcf503c8de530613dea813cfa90984c058d1910bab7cb010674
5
5
  SHA512:
6
- metadata.gz: 4471aa257cc7761633fca706db570b61cf4315f22d512c90a2419666f2c1bfd97647196a71fa8fd0d85f1cf16cede1beb69dce20ba6d98a29c52727aa6342c37
7
- data.tar.gz: 0c3ac3e520ab620528ec8dd125cdee8092adea4ad6a2e1c877e30a10598219d0ad8abcb15eb40e1509561587323d8f05f653b68b3d7d112bd2cf44c9a6b8e6e5
6
+ metadata.gz: 8e6d8819e37fd3d417641dc1745360c9ff52df0ee90399ad844ad7d3c23990d1c74f9db31d698e17861881e8776f5fb3fb4aae07ab4d9e2762e257ffd334d51f
7
+ data.tar.gz: 902ece75d3590486435729195e741834c4613d379f47ca29b93ba68281810273b36ae94374c9c9b317ca49464e60c1be15d344b88c94bada8fd1f8ea5668dde1
@@ -472,7 +472,7 @@ module Rodauth
472
472
  end
473
473
 
474
474
  def only_json?
475
- scope.class.opts[:rodauth_json] == :only
475
+ scope.class.rodauth_json == :only
476
476
  end
477
477
 
478
478
  def post_configure
@@ -769,7 +769,7 @@ module Rodauth
769
769
  end
770
770
 
771
771
  def require_account_session
772
- unless account_from_session
772
+ unless (@account_retrieval_type == :session ? account : account_from_session)
773
773
  clear_session
774
774
  login_required
775
775
  end
@@ -834,11 +834,11 @@ module Rodauth
834
834
  end
835
835
 
836
836
  def use_request_specific_csrf_tokens?
837
- scope.opts[:rodauth_route_csrf] && scope.use_request_specific_csrf_tokens?
837
+ scope.class.rodauth_route_csrf? && scope.use_request_specific_csrf_tokens?
838
838
  end
839
839
 
840
840
  def check_csrf?
841
- scope.opts[:rodauth_route_csrf]
841
+ scope.class.rodauth_route_csrf?
842
842
  end
843
843
 
844
844
  def function_name(name)
@@ -13,6 +13,8 @@ module Rodauth
13
13
  set_password(password)
14
14
  rescue Rodauth::SetPasswordFailure
15
15
  return false
16
+ else
17
+ @existing_password_hash_or_salt = nil
16
18
  end
17
19
  end
18
20
 
@@ -265,7 +265,7 @@ module Rodauth
265
265
 
266
266
  def _login_form_footer_links
267
267
  links = super
268
- if !param_or_nil(login_param) || ((account || account_from_login(login_param_value)) && allow_resending_verify_account_email?)
268
+ if !param_or_nil(login_param) || ((account || (@account_retrieval_type != :login && account_from_login(login_param_value))) && allow_resending_verify_account_email?)
269
269
  links << [30, verify_account_resend_path, verify_account_resend_link_text]
270
270
  end
271
271
  links
@@ -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 = 48
9
+ MINOR = 49
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
@@ -1,6 +1,7 @@
1
1
  # frozen-string-literal: true
2
2
 
3
3
  require 'securerandom'
4
+ require 'roda'
4
5
 
5
6
  module Rodauth
6
7
  OPTS = {}.freeze
@@ -22,7 +23,7 @@ module Rodauth
22
23
  end
23
24
 
24
25
  def self.load_dependencies(app, opts=OPTS, &_)
25
- json_opt = opts.fetch(:json, app.opts[:rodauth_json])
26
+ json_opt = opts.fetch(:json){app.opts[:rodauth_json]}
26
27
  if json_opt
27
28
  app.plugin :json
28
29
  app.plugin :json_parser
@@ -34,7 +35,7 @@ module Rodauth
34
35
  app.plugin :render
35
36
  end
36
37
 
37
- case opts.fetch(:csrf, app.opts[:rodauth_csrf])
38
+ case opts.fetch(:csrf){app.opts[:rodauth_csrf]}
38
39
  when false
39
40
  # nothing
40
41
  when :rack_csrf
@@ -51,22 +52,23 @@ module Rodauth
51
52
  end
52
53
 
53
54
  def self.configure(app, opts=OPTS, &block)
54
- json_opt = app.opts[:rodauth_json] = opts.fetch(:json, app.opts[:rodauth_json])
55
- csrf = app.opts[:rodauth_csrf] = opts.fetch(:csrf, app.opts[:rodauth_csrf])
55
+ json_opt = app.opts[:rodauth_json] = opts.fetch(:json){app.rodauth_json}
56
+ csrf = app.opts[:rodauth_csrf] = opts.fetch(:csrf){app.opts[:rodauth_csrf]}
56
57
  app.opts[:rodauth_route_csrf] = case csrf
57
58
  when false, :rack_csrf
58
59
  false
59
60
  else
60
61
  json_opt != :only
61
62
  end
62
- auth_class = (app.opts[:rodauths] ||= {})[opts[:name]] ||= opts[:auth_class] || Class.new(Auth)
63
+ name = opts[:name]
64
+ auth_class = (app.opts[:rodauths] ||= {})[name] ||= opts[:auth_class] || Class.new(Auth)
63
65
  if !auth_class.roda_class
64
66
  auth_class.roda_class = app
65
67
  elsif auth_class.roda_class != app
66
- auth_class = app.opts[:rodauths][opts[:name]] = Class.new(auth_class)
68
+ auth_class = app.rodauths[name] = Class.new(auth_class)
67
69
  auth_class.roda_class = app
68
70
  end
69
- auth_class.class_eval{@configuration_name = opts[:name] unless defined?(@configuration_name)}
71
+ auth_class.class_eval{@configuration_name = name unless defined?(@configuration_name)}
70
72
  auth_class.configure(&block) if block
71
73
  auth_class.send(:make_shape_friendly)
72
74
  auth_class.allocate.post_configure if auth_class.method_defined?(:post_configure)
@@ -519,8 +521,28 @@ module Rodauth
519
521
  end
520
522
 
521
523
  module ClassMethods
524
+ if Roda::RodaPlugins.respond_to?(:opt_attr_reader)
525
+ Roda::RodaPlugins.opt_attr_reader(self, :rodauths)
526
+ Roda::RodaPlugins.opt_attr_reader(self, :rodauth_json)
527
+ Roda::RodaPlugins.opt_attr_reader(self, :rodauth_route_csrf, name: :rodauth_route_csrf?)
528
+ # simplecov:disable
529
+ else
530
+ def rodauths
531
+ opts[:rodauths]
532
+ end
533
+
534
+ def rodauth_json
535
+ opts[:rodauth_json]
536
+ end
537
+
538
+ def rodauth_route_csrf?
539
+ opts[:rodauth_route_csrf]
540
+ end
541
+ # simplecov:enable
542
+ end
543
+
522
544
  def rodauth(name=nil)
523
- opts[:rodauths][name]
545
+ rodauths[name]
524
546
  end
525
547
 
526
548
  def precompile_rodauth_templates
@@ -540,8 +562,8 @@ module Rodauth
540
562
  end
541
563
 
542
564
  def freeze
543
- opts[:rodauths].each_value(&:freeze)
544
- opts[:rodauths].freeze
565
+ rodauths.each_value(&:freeze)
566
+ rodauths.freeze
545
567
  super
546
568
  end
547
569
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.48.0
4
+ version: 2.49.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans