From 5345e419df0b6bb9d8d4ae749bbc714d4600a4ab Mon Sep 17 00:00:00 2001 From: sto Date: Wed, 10 Dec 2025 17:43:00 +0100 Subject: [PATCH] Fix password change --- app/models/user.rb | 1 - spec/features/user_spec.rb | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 7128e69..f1d84db 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 9873135..329472e 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -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