From 5221c5400e193a64ab607d7de7c0450f5f15cd55 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 17 Jul 2026 18:20:25 +0200 Subject: Allow updating migrated users without supplying a password password_required? treated a blank crypted_password as "needs a password", but after bcrypt migration crypted_password is nil by design -- every subsequent save of a migrated or new user failed validation. The predicate now requires a password only when both the legacy and the bcrypt credential are absent, or when one is actually being set. --- test/models/user_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/models/user_test.rb') diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 514bdea..feccce2 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -118,6 +118,14 @@ class UserTest < ActiveSupport::TestCase # Second login should now use password_digest. assert_equal user, User.authenticate("quentin", "monkey") end + + def test_migrated_user_can_be_updated_without_password + user = users(:quentin) + assert_equal user, User.authenticate("quentin", "monkey") + user.reload + + assert user.update(:email => "quentin@example.org") + end protected def create_user(options = {}) -- cgit v1.3