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 +4 -4
- data/lib/rodauth/features/base.rb +4 -4
- data/lib/rodauth/features/update_password_hash.rb +2 -0
- data/lib/rodauth/features/verify_account.rb +1 -1
- data/lib/rodauth/version.rb +1 -1
- data/lib/rodauth.rb +32 -10
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24077da1fc384a74f6e692220eeac283243ce13c0d219befdbd43c4a3498ab63
|
|
4
|
+
data.tar.gz: b05d593e3e12ebcf503c8de530613dea813cfa90984c058d1910bab7cb010674
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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.
|
|
837
|
+
scope.class.rodauth_route_csrf? && scope.use_request_specific_csrf_tokens?
|
|
838
838
|
end
|
|
839
839
|
|
|
840
840
|
def check_csrf?
|
|
841
|
-
scope.
|
|
841
|
+
scope.class.rodauth_route_csrf?
|
|
842
842
|
end
|
|
843
843
|
|
|
844
844
|
def function_name(name)
|
|
@@ -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
|
data/lib/rodauth/version.rb
CHANGED
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
|
|
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
|
|
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
|
|
55
|
-
csrf = app.opts[:rodauth_csrf] = opts.fetch(: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
|
-
|
|
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.
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
544
|
-
|
|
565
|
+
rodauths.each_value(&:freeze)
|
|
566
|
+
rodauths.freeze
|
|
545
567
|
super
|
|
546
568
|
end
|
|
547
569
|
end
|