Fix password change
All checks were successful
CI / scan_ruby (push) Successful in 20s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 40s

This commit is contained in:
sto
2025-12-10 17:43:00 +01:00
parent 2c87a5b63c
commit 5345e419df
2 changed files with 0 additions and 11 deletions

View File

@@ -26,5 +26,4 @@ class User < ApplicationRecord
validates :username, presence: true, uniqueness: true
validates :email_address, presence: true, uniqueness: true
validates :lang, inclusion: { in: Languages::AVAILABLE_LANGUAGES.map { |lang| lang[:id] } }
validates :password, presence: true, if: -> { password_change_attempt }
end

View File

@@ -69,16 +69,6 @@ RSpec.feature "Users", type: :feature do
.to change(user, :password_digest)
.and change { user.authenticate("new_password") }.from(false).to(user)
end
it "should prevent changing to a blank password" do
visit edit_user_path(user)
fill_in I18n.t("activerecord.attributes.user.password"), with: ""
expect { click_button(I18n.t("helpers.buttons.save_password")); user.reload }.not_to change(user, :password)
expect(page).to have_content(I18n.t("activerecord.errors.models.user.attributes.password.blank"))
end
end
end