From 48a3b62784d08ce8b04ba136713602a33887be7a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 07:34:38 +0000 Subject: [PATCH 1/7] Initial plan From f98c930f9a08e25aa5c588d4f8a8709d032270cd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:31:16 +0000 Subject: [PATCH 2/7] Add password requirements and improve error messaging - Add visible password requirement hint (5 characters minimum) on change password form - Add visible password requirement hint on Devise password reset form - Enhance password error display with icon and clearer formatting - Create custom Devise error messages partial with better styling - Add HTML5 minlength validation to prevent browser default error icon Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- app/views/devise/passwords/edit.html.erb | 30 ++++++----- app/views/devise/sessions/new.html.erb | 5 +- .../devise/shared/_error_messages.html.erb | 21 ++++++++ app/views/users/_password_errors.html.erb | 22 +++++--- app/views/users/change_password.html.erb | 52 +++++++++++-------- app/views/welcome/show.html.erb | 36 +++++++------ 6 files changed, 105 insertions(+), 61 deletions(-) create mode 100644 app/views/devise/shared/_error_messages.html.erb diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 1073a31e8..f447bacce 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -16,14 +16,14 @@
<%= f.password_field :password, - class: "w-full form-control form-input password-field pr-10", - required: true, - minlength: 5, - autofocus: true, - autocomplete: "new-password", - autocorrect: "off", - autocapitalize: "off", - spellcheck: "false", + class: "w-full form-control form-input password-field pr-10", + required: true, + minlength: 5, + autofocus: true, + autocomplete: "current-password", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", data: { password_toggle_target: "input" } %> @@ -38,14 +40,16 @@
<%= f.password_field :password, - id: "change-password-new-password", - class: "w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 p-2 pr-10", - required: true, - autocomplete: "new-password", - autocorrect: "off", - autocapitalize: "off", - spellcheck: "false", - data: { password_toggle_target: "input" } %> + id: "change-password-new-password", + class: "w-full form-control form-input password-field pr-10", + required: true, + minlength: 5, + autofocus: true, + autocomplete: "new-password", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", + data: { password_toggle_target: "input" } %> @@ -56,14 +60,16 @@
<%= f.password_field :password_confirmation, - id: "change-password-new-password-confirmation", - class: "w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 p-2 pr-10", - required: true, - autocomplete: "new-password", - autocorrect: "off", - autocapitalize: "off", - spellcheck: "false", - data: { password_toggle_target: "input" } %> + id: "change-password-new-password-confirmation", + class: "w-full form-control form-input password-field pr-10", + required: true, + minlength: 5, + autofocus: true, + autocomplete: "new-password", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", + data: { password_toggle_target: "input" } %> diff --git a/app/views/welcome/show.html.erb b/app/views/welcome/show.html.erb index ea424bebb..9fb2e6ec9 100644 --- a/app/views/welcome/show.html.erb +++ b/app/views/welcome/show.html.erb @@ -23,14 +23,16 @@
<%= f.password_field :password, - id: "change-password-new-password", - class: "w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 p-2 pr-10", - required: true, - autocomplete: "new-password", - autocorrect: "off", - autocapitalize: "off", - spellcheck: "false", - data: { password_toggle_target: "input" } %> + id: "change-password-new-password", + class: "w-full form-control form-input password-field pr-10", + required: true, + minlength: 5, + autofocus: true, + autocomplete: "new-password", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", + data: { password_toggle_target: "input" } %> @@ -42,14 +44,16 @@
<%= f.password_field :password_confirmation, - id: "change-password-new-password-confirmation", - class: "w-full rounded-md border-gray-300 shadow-sm focus:ring-blue-500 focus:border-blue-500 p-2 pr-10", - required: true, - autocomplete: "new-password", - autocorrect: "off", - autocapitalize: "off", - spellcheck: "false", - data: { password_toggle_target: "input" } %> + id: "change-password-new-password-confirmation", + class: "w-full form-control form-input password-field pr-10", + required: true, + minlength: 5, + autofocus: true, + autocomplete: "new-password", + autocorrect: "off", + autocapitalize: "off", + spellcheck: "false", + data: { password_toggle_target: "input" } %> From ca9d55e198b6f9adc0fe864ea2c4d6e35649210b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 21:32:06 +0000 Subject: [PATCH 3/7] Add view specs for password forms - Add spec for users/change_password view to verify password requirements display - Add spec for devise/passwords/edit view to verify password requirements display - Test error message display and formatting Co-authored-by: maebeale <7607813+maebeale@users.noreply.github.com> --- .../devise/passwords/edit.html.erb_spec.rb | 31 +++++++++++ .../users/change_password.html.erb_spec.rb | 53 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 spec/views/users/change_password.html.erb_spec.rb diff --git a/spec/views/devise/passwords/edit.html.erb_spec.rb b/spec/views/devise/passwords/edit.html.erb_spec.rb index 256e8cc54..a6f5b1f67 100644 --- a/spec/views/devise/passwords/edit.html.erb_spec.rb +++ b/spec/views/devise/passwords/edit.html.erb_spec.rb @@ -7,6 +7,7 @@ user.reset_password_token = Devise.friendly_token assign(:resource, user) assign(:resource_name, :user) +<<<<<<< HEAD u = user mapping = Devise.mappings[:user] view.define_singleton_method(:resource) { u } @@ -15,6 +16,21 @@ render end +======= + allow(view).to receive(:resource).and_return(user) + allow(view).to receive(:resource_name).and_return(:user) + render + end + + it "displays password requirements hint" do + expect(rendered).to have_content("Password must be at least 5 characters long") + end + + it "has minlength attribute on password field" do + expect(rendered).to have_css('input[type="password"][minlength="5"]') + end + +>>>>>>> 8d996c5fb (Add view specs for password forms) it "displays new password field" do expect(rendered).to have_field("New password", type: :password) end @@ -27,6 +43,7 @@ expect(rendered).to have_button("Set password") end +<<<<<<< HEAD it "displays password requirements hint" do expect(rendered).to have_content("Password must be at least 5 characters long") end @@ -35,6 +52,8 @@ expect(rendered).to have_css('input[type="password"][minlength="5"]') end +======= +>>>>>>> 8d996c5fb (Add view specs for password forms) context "when user has password errors" do before do user.errors.add(:password, "is too short (minimum is 5 characters)") @@ -42,6 +61,7 @@ render end +<<<<<<< HEAD it "displays error explanation container" do expect(rendered).to have_css('div#error_explanation') end @@ -51,5 +71,16 @@ expect(rendered).to have_content("Password is too short") expect(rendered).to have_content("Password confirmation doesn't match") end +======= + it "displays error messages" do + expect(rendered).to have_content("prevented this from being saved") + expect(rendered).to have_content("Password is too short") + expect(rendered).to have_content("Password confirmation doesn't match") + end + + it "displays error explanation with proper styling" do + expect(rendered).to have_css('div[role="alert"]#error_explanation') + end +>>>>>>> 8d996c5fb (Add view specs for password forms) end end diff --git a/spec/views/users/change_password.html.erb_spec.rb b/spec/views/users/change_password.html.erb_spec.rb new file mode 100644 index 000000000..cceaacd7b --- /dev/null +++ b/spec/views/users/change_password.html.erb_spec.rb @@ -0,0 +1,53 @@ +require 'rails_helper' + +RSpec.describe "users/change_password", type: :view do + let(:user) { create(:user) } + + before do + assign(:user, user) + allow(view).to receive(:current_user).and_return(user) + render + end + + it "displays password requirements hint" do + expect(rendered).to have_content("Password must be at least 5 characters long") + end + + it "has minlength attribute on password field" do + expect(rendered).to have_css('input[type="password"][minlength="5"]#change-password-new-password') + end + + it "displays current password field" do + expect(rendered).to have_field("Current password", type: :password) + end + + it "displays new password field" do + expect(rendered).to have_field("New password", type: :password) + end + + it "displays password confirmation field" do + expect(rendered).to have_field("New password confirmation", type: :password) + end + + it "has a submit button" do + expect(rendered).to have_button("Change Password") + end + + context "when user has password errors" do + before do + user.errors.add(:password, "is too short (minimum is 5 characters)") + user.errors.add(:current_password, "is invalid") + render + end + + it "displays error messages" do + expect(rendered).to have_content("There was a problem with your password") + expect(rendered).to have_content("Password is too short") + expect(rendered).to have_content("Current password is invalid") + end + + it "displays error alert with proper styling" do + expect(rendered).to have_css('div[role="alert"]#password-errors') + end + end +end From 5f53a098116b4e6db4256843d86135d076fbc022 Mon Sep 17 00:00:00 2001 From: maebeale Date: Mon, 16 Feb 2026 18:46:16 -0500 Subject: [PATCH 4/7] Use fontawesome --- app/views/devise/shared/_error_messages.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/devise/shared/_error_messages.html.erb b/app/views/devise/shared/_error_messages.html.erb index 2238216f6..1f99f86c8 100644 --- a/app/views/devise/shared/_error_messages.html.erb +++ b/app/views/devise/shared/_error_messages.html.erb @@ -2,9 +2,7 @@