searls-auth 1.0.0 → 1.0.1

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: '09b9515ef89e82e747cc35c415a4de145cf8e61634caccb137ceb8f429a54bdc'
4
- data.tar.gz: e5b456ac99cc9ad784ed8727266dc3e073e6ee850ad720be0a4a42e894e2bbe8
3
+ metadata.gz: 4fbce83eb529408eab5ccd2d5bb1812e3a498cf0c850df112080e043d7a3dc0c
4
+ data.tar.gz: '029224229936f9e33585fa99bb11cf077912b8cda143b1c348f27cc85d74556c'
5
5
  SHA512:
6
- metadata.gz: 6c5163daa1551674b1c128ecf8a6d155cde36123780bf2332ef5d9f79166d37a964616f6fda17c97eb2608df9d13ad54f6f25e5c384ef2308b8740f93e326302
7
- data.tar.gz: 4bfdd8c989591a52aeb52cf91bbf55e189442e57031d877f0e81f88c45d51d8cd22bd8ca21f31be10370c68b3981e410b2a034ed6c69738b28ee10cfcca078d0
6
+ metadata.gz: 99f4d3c9ac6659ab032153726042d4280c2aa8f273b6d18ca2abe72ff337301671dd92a85227c615d01405193a769c20b09297e4f84c020448786aa99c035b52
7
+ data.tar.gz: 26d57bfb5d1b1cb69ffabad31618577a7cdf7f3ed3101c5f4b0424ca2e445a419c15d506eca82dce640ed9ccba7f9d91d7aa7b7e105e0f3efca966b7740b139f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.1] - 2025-10-11
4
+
5
+ * Skip database-aware configuration validations when Active Record migrations are pending
6
+
3
7
  ## [1.0.0] - 2025-10-04
4
8
 
5
9
  * **BREAKING:** Rename `default_redirect_path_after_register` to `redirect_path_after_register`
@@ -165,9 +165,12 @@ module Searls
165
165
  if using_default_hooks && defined?(::User)
166
166
  missing = []
167
167
  missing << "User#authenticate" unless ::User.method_defined?(:authenticate)
168
- has_password_digest_method = ::User.method_defined?(:password_digest)
169
- has_password_digest_column = ::User.respond_to?(:column_names) && ::User.column_names.include?("password_digest")
170
- missing << "users.password_digest" unless has_password_digest_method || has_password_digest_column
168
+ unless schema_checks_blocked?
169
+ has_password_digest_method = ::User.method_defined?(:password_digest)
170
+ has_password_digest_column = ::User.respond_to?(:column_names) && ::User.column_names.include?("password_digest")
171
+ missing << "users.password_digest" unless has_password_digest_method || has_password_digest_column
172
+ end
173
+
171
174
  if missing.any?
172
175
  raise Searls::Auth::Error, "Password login requires #{missing.join(" and ")}. Add bcrypt/has_secure_password or override password hooks."
173
176
  end
@@ -255,7 +258,7 @@ module Searls
255
258
  end
256
259
  has_email_method = ::User.method_defined?(:email)
257
260
  has_email_column = ::User.respond_to?(:column_names) && ::User.column_names.include?("email")
258
- unless has_email_method || has_email_column
261
+ unless schema_checks_blocked? || has_email_method || has_email_column
259
262
  raise Searls::Auth::Error, "Default :user_finder_by_email expects a `users.email` attribute."
260
263
  end
261
264
  end
@@ -274,7 +277,7 @@ module Searls
274
277
  probe = ::User.new
275
278
  has_email_setter = probe.respond_to?(:email=)
276
279
  has_email_column = ::User.respond_to?(:column_names) && ::User.column_names.include?("email")
277
- unless has_email_setter || has_email_column
280
+ unless schema_checks_blocked? || has_email_setter || has_email_column
278
281
  raise Searls::Auth::Error, "Default :user_initializer expects a writable email attribute on User."
279
282
  end
280
283
  rescue ArgumentError
@@ -289,6 +292,19 @@ module Searls
289
292
  end
290
293
  end
291
294
  end
295
+
296
+ def schema_checks_blocked?
297
+ return true unless defined?(::ActiveRecord)
298
+ begin
299
+ if !::ActiveRecord::Base.connected? ||
300
+ !::ActiveRecord::Base.connection&.migration_context.present? ||
301
+ ::ActiveRecord::Base.connection.migration_context.needs_migration?
302
+ true
303
+ end
304
+ rescue
305
+ true
306
+ end
307
+ end
292
308
  end
293
309
  end
294
310
  end
@@ -14,8 +14,6 @@ module Searls
14
14
  else
15
15
  if input.respond_to?(:in_time_zone)
16
16
  input.in_time_zone
17
- else
18
- parse_string(input.to_s)
19
17
  end
20
18
  end
21
19
  rescue ArgumentError, TypeError, NoMethodError
@@ -1,5 +1,5 @@
1
1
  module Searls
2
2
  module Auth
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searls-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls