rodauth 2.10.0 → 2.11.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: 5286a570d72b6bc951ca489e12a696a4c2348d789d09f2782cfbd3521e63ee6d
4
- data.tar.gz: be5d4e5bef18f6f62978bc84e07da1c4b31db4f03bf104d01abf8510812c5719
3
+ metadata.gz: 52cc814306a88708a5ade63bfa8288521db20517fdac543217e86a084e8e189f
4
+ data.tar.gz: ebd02824ee15ede1c58a5ca93c092d2372e953790f7535d0889521bc95b9dfd3
5
5
  SHA512:
6
- metadata.gz: 98a849b965bfee4d80b8b6f6fc286d22f57673bf37da4e2cb338c114275795b665e46b561781f688dbb2ddfdd312e8b393f545d1920ac9f83024e042ff97cee0
7
- data.tar.gz: 46da808a9d2e38c647339eed1554183b0e175fb3dbf4fd04d49d78015ff523bc0960091b3643bbc3913cfce88b7f78a240bd1857002de889a2d9455f106e4e03
6
+ metadata.gz: 435b51b083c4509626c0699c2298c641134b132e0c08fae0c738823f4230d35d2a714761b7afdb2c9a48bb7c025e653a2bce84ae88b07f21a2bd5b494b52e6cc
7
+ data.tar.gz: 179b131a07064033a1c934360578f8b7a8703421133179255078063d9bde7621f9865c3bb00f51dceb313255e4d685804ba2f1a0ba2d109198f660802d6eda61
data/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
+ === 2.11.0 (2021-03-22)
2
+
3
+ * Add same_as_current_login_message and contains_null_byte_message configuration methods to increase translatability (dmitryzuev) (#158)
4
+
5
+ * Allow the rodauth plugin to be loaded without a block (janko) (#157)
6
+
7
+ * Use new-password autocomplete value for the password fields on the reset password form (basabin54) (#155)
8
+
9
+ * Support :auth_class plugin option, to use a specific class instead of creating a Rodauth::Auth subclass (janko) (#153)
10
+
11
+ * Make Rodauth configuration work correctly if the rodauth plugin is loaded more than once (janko) (#152)
12
+
1
13
  === 2.10.0 (2021-02-22)
2
14
 
3
15
  * Add argon2 feature to allow use of the argon2 password hash algorithm instead of bcrypt (AlexeyMatskevich, jeremyevans) (#147)
data/README.rdoc CHANGED
@@ -852,6 +852,9 @@ which configures which dependent plugins should be loaded. Options:
852
852
  still need to load the render plugin manually.
853
853
  :name :: Provide a name for the given Rodauth configuration, used to
854
854
  support multiple Rodauth configurations in a given Roda application.
855
+ :auth_class :: Provide a specific Rodauth::Auth subclass that should be set
856
+ on the Roda application. By default, an anonymous
857
+ Rodauth::Auth subclass is created.
855
858
 
856
859
  === Feature Documentation
857
860
 
@@ -13,6 +13,7 @@ change_login_page_title :: The page title to use on the change login form.
13
13
  change_login_redirect :: Where to redirect after a sucessful login change.
14
14
  change_login_requires_password? :: Whether a password is required when changing logins.
15
15
  change_login_route :: The route to the change login action. Defaults to +change-login+.
16
+ same_as_current_login_message :: The error message to display if using the same value as the current login when changing the login.
16
17
 
17
18
  == Auth Methods
18
19
 
@@ -6,6 +6,7 @@ use a Rodauth feature that requires setting logins or passwords.
6
6
  == Auth Value Methods
7
7
 
8
8
  already_an_account_with_this_login_message :: The error message to display when there already exists an account with the same login.
9
+ contains_null_byte_message :: The error message to display when the password contains a null byte.
9
10
  login_confirm_label :: The label to use for login confirmations.
10
11
  login_confirm_param :: The parameter name to use for login confirmations.
11
12
  login_does_not_meet_requirements_message :: The error message to display when the login does not meet the requirements you have set.
@@ -0,0 +1,31 @@
1
+ = New Features
2
+
3
+ * An :auth_class rodauth plugin option has been added, allowing a user
4
+ to specify a specific Rodauth::Auth subclass to use, instead of
5
+ always using a new subclass of Rodauth::Auth. This is designed for
6
+ advanced configurations or other frameworks that build on top of
7
+ Rodauth, which may want to customize the Rodauth::Auth subclasses to
8
+ use.
9
+
10
+ * Two additional configuration methods have been added for easier
11
+ translatability, fixing issues where English text was hardcoded:
12
+
13
+ * same_as_current_login_message (change_login feature)
14
+ * contains_null_byte_message (login_password_requirements_base
15
+ feature)
16
+
17
+ = Other Improvements
18
+
19
+ * Loading the rodauth plugin multiple times in the same application
20
+ with different blocks now works better. The same context is now
21
+ shared between the blocks, so you can load features in one block
22
+ and call configuration methods added by the feature in the other
23
+ block. Previously, you could only call configuration methods in
24
+ the block that added the feature, and enabling a feature in a
25
+ block that was already enabled in a previous block did not allow
26
+ the use of configuraton methods related to the feature.
27
+
28
+ * Passing a block when loading the rodauth plugin is now optional.
29
+
30
+ * The autocomplete attribute on the reset password form now uses
31
+ new-password instead of current-password.
data/lib/rodauth.rb CHANGED
@@ -39,14 +39,14 @@ module Rodauth
39
39
  else
40
40
  json_opt != :only
41
41
  end
42
- auth_class = (app.opts[:rodauths] ||= {})[opts[:name]] ||= Class.new(Auth)
42
+ auth_class = (app.opts[:rodauths] ||= {})[opts[:name]] ||= opts[:auth_class] || Class.new(Auth)
43
43
  if !auth_class.roda_class
44
44
  auth_class.roda_class = app
45
45
  elsif auth_class.roda_class != app
46
46
  auth_class = app.opts[:rodauths][opts[:name]] = Class.new(auth_class)
47
47
  auth_class.roda_class = app
48
48
  end
49
- auth_class.configure(&block)
49
+ auth_class.configure(&block) if block
50
50
  end
51
51
 
52
52
  FEATURES = {}
@@ -268,11 +268,12 @@ module Rodauth
268
268
  @features = []
269
269
  @routes = []
270
270
  @route_hash = {}
271
+ @configuration = Configuration.new(self)
271
272
  end
272
273
  end
273
274
 
274
275
  def self.configure(&block)
275
- Configuration.new(self, &block)
276
+ @configuration.apply(&block)
276
277
  end
277
278
 
278
279
  def self.freeze
@@ -288,6 +289,14 @@ module Rodauth
288
289
 
289
290
  def initialize(auth, &block)
290
291
  @auth = auth
292
+ # :nocov:
293
+ # Only for backwards compatibility
294
+ # RODAUTH3: Remove
295
+ apply(&block) if block
296
+ # :nocov:
297
+ end
298
+
299
+ def apply(&block)
291
300
  load_feature(:base)
292
301
  instance_exec(&block)
293
302
  auth.allocate.post_configure
@@ -6,6 +6,7 @@ module Rodauth
6
6
 
7
7
  notice_flash 'Your login has been changed'
8
8
  error_flash 'There was an error changing your login'
9
+ translatable_method :same_as_current_login_message, 'same as current login'
9
10
  loaded_templates %w'change-login login-field login-confirm-field password-field'
10
11
  view 'change-login', 'Change Login'
11
12
  after
@@ -64,7 +65,7 @@ module Rodauth
64
65
 
65
66
  def change_login(login)
66
67
  if account_ds.get(login_column).downcase == login.downcase
67
- @login_requirement_message = 'same as current login'
68
+ @login_requirement_message = same_as_current_login_message
68
69
  return false
69
70
  end
70
71
 
@@ -51,7 +51,11 @@ module Rodauth
51
51
  end
52
52
 
53
53
  def token_link(route, param, key)
54
- route_url(route, param => "#{account_id}#{token_separator}#{convert_email_token_key(key)}")
54
+ route_url(route, param => token_param_value(key))
55
+ end
56
+
57
+ def token_param_value(key)
58
+ "#{account_id}#{token_separator}#{convert_email_token_key(key)}"
55
59
  end
56
60
 
57
61
  def convert_email_token_key(key)
@@ -71,7 +75,6 @@ module Rodauth
71
75
  return
72
76
  end
73
77
  end
74
-
75
78
  ds = account_ds(id)
76
79
  ds = ds.where(account_status_column=>status_id) if status_id && !skip_status_checks?
77
80
  ds.first
@@ -16,6 +16,7 @@ module Rodauth
16
16
  auth_value_method :require_login_confirmation?, true
17
17
  auth_value_method :require_password_confirmation?, true
18
18
  translatable_method :same_as_existing_password_message, "invalid password, same as current password"
19
+ translatable_method :contains_null_byte_message, 'contains null byte'
19
20
 
20
21
  auth_value_methods(
21
22
  :login_confirm_label,
@@ -124,7 +125,7 @@ module Rodauth
124
125
 
125
126
  def password_does_not_contain_null_byte?(password)
126
127
  return true unless password.include?("\0")
127
- @password_requirement_message = 'contains null byte'
128
+ @password_requirement_message = contains_null_byte_message
128
129
  false
129
130
  end
130
131
 
@@ -100,6 +100,7 @@ module Rodauth
100
100
  route do |r|
101
101
  check_already_logged_in
102
102
  before_reset_password_route
103
+ @password_field_autocomplete_value = 'new-password'
103
104
 
104
105
  r.get do
105
106
  if key = param_or_nil(reset_password_key_param)
@@ -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 = 10
9
+ MINOR = 11
10
10
 
11
11
  # The patch version of Rodauth, updated only for bug fixes from the last
12
12
  # feature release.
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.10.0
4
+ version: 2.11.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: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2021-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -321,6 +321,7 @@ extra_rdoc_files:
321
321
  - doc/release_notes/2.0.0.txt
322
322
  - doc/release_notes/2.1.0.txt
323
323
  - doc/release_notes/2.10.0.txt
324
+ - doc/release_notes/2.11.0.txt
324
325
  - doc/release_notes/2.2.0.txt
325
326
  - doc/release_notes/2.3.0.txt
326
327
  - doc/release_notes/2.4.0.txt
@@ -413,6 +414,7 @@ files:
413
414
  - doc/release_notes/2.0.0.txt
414
415
  - doc/release_notes/2.1.0.txt
415
416
  - doc/release_notes/2.10.0.txt
417
+ - doc/release_notes/2.11.0.txt
416
418
  - doc/release_notes/2.2.0.txt
417
419
  - doc/release_notes/2.3.0.txt
418
420
  - doc/release_notes/2.4.0.txt