Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix password confirm validation error message #11625

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion decidim-core/app/forms/decidim/account_form.rb
Expand Up @@ -24,7 +24,7 @@ class AccountForm < Form
validates :nickname, presence: true, format: { with: Decidim::User::REGEXP_NICKNAME }

validates :nickname, length: { maximum: Decidim::User.nickname_max_length, allow_blank: true }
validates :password, confirmation: true
validates :password, confirmation: { message: '"Confirm your password" does not match Password' }
greenwoodt marked this conversation as resolved.
Show resolved Hide resolved
validates :password, password: { name: :name, email: :email, username: :nickname }, if: -> { password.present? }
validates :password_confirmation, presence: true, if: :password_present
validates :avatar, passthru: { to: Decidim::User }
Expand Down
13 changes: 13 additions & 0 deletions decidim-core/spec/forms/account_form_spec.rb
Expand Up @@ -155,6 +155,19 @@ module Decidim
end
end

describe "password_confirmation" do
greenwoodt marked this conversation as resolved.
Show resolved Hide resolved
context "when the password confirmaiton does not match" do
let(:password_confirmation) { "aaaabbbbcccc" }

it { is_expected.to be_invalid }

it "adds the correct error" do
subject.valid?
expect(subject.errors[:password_confirmation]).to include('"Confirm your password" does not match Password')
end
end
end

describe "personal_url" do
context "when it doesn't start with http" do
let(:personal_url) { "example.org" }
Expand Down