Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ GEM
bigdecimal (4.0.1)
bootsnap (1.21.1)
msgpack (~> 1.2)
brakeman (8.0.1)
brakeman (8.0.2)
racc
builder (3.3.0)
bullet (8.1.0)
Expand Down Expand Up @@ -638,7 +638,7 @@ CHECKSUMS
bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
binding_of_caller (1.0.1)
bootsnap (1.21.1) sha256=9373acfe732da35846623c337d3481af8ce77c7b3a927fb50e9aa92b46dbc4c4
brakeman (8.0.1) sha256=c68ce0ac35a6295027c4eab8b4ac597d2a0bfc82f0d62dcd334bbf944d352f70
brakeman (8.0.2) sha256=7b02065ce8b1de93949cefd3f2ad78e8eb370e644b95c8556a32a912a782426a
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
bullet (8.1.0) sha256=604b7e2636ec2137dcab3ba61a56248c39a0004a0c9405d58bad0686d23b98ff
bundler-audit (0.9.3) sha256=81c8766c71e47d0d28a0f98c7eed028539f21a6ea3cd8f685eb6f42333c9b4e9
Expand Down
2 changes: 2 additions & 0 deletions app/views/users/change_password.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
autocapitalize: "off",
spellcheck: "false",
input_html: {
id: "change-password-new-password",
class: "rounded-md border-gray-300 shadow-sm
focus:ring-blue-500 focus:border-blue-500
p-2 pr-10 w-full",
Expand Down Expand Up @@ -79,6 +80,7 @@
spellcheck: "false",
required: true,
input_html: {
id: "change-password-new-password-confirmation",
class: "rounded-md border-gray-300 shadow-sm
focus:ring-blue-500 focus:border-blue-500
p-2 pr-10",
Expand Down
52 changes: 52 additions & 0 deletions spec/system/reset_password_facilitator_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Reset password (facilitator)', type: :system do
let(:facilitator_user) { create(:user, :with_facilitator) }

before do
sign_in facilitator_user
# Start on a page where the user nav is visible
visit root_path
# Open user nav dropdown
find('#avatar button').click
# Click "Change password"
click_link 'Change password'
end

context "When user uses form to change password" do
it "fills out the form, submits, and stays logged in" do
expect(page).to have_current_path(change_password_path)

fill_in "Current password", with: "MyString"
fill_in "change-password-new-password", with: "new_secure_password"
fill_in "change-password-new-password-confirmation", with: "new_secure_password"
click_button "Change Password"

expect(page).to have_current_path(root_path)
expect(page).to have_content("Your Password was updated.")
expect(page).to have_css("#avatar")
end
end

context "When user opts to 'Log out and reset' for forgotten passwords" do
it 'logs the user out and lands on the password reset page when they choose to reset' do
# Should be on the change password page
expect(page).to have_current_path(change_password_path)

# Click "Log out and reset it." and accept the confirm dialog
accept_confirm do
click_link 'Log out and reset it.'
end

# Confirm we are on the password reset page
expect(page).to have_current_path(new_user_password_path)
expect(page).to have_content('Forgot your password?')

# Confirm user is logged out (nav shows Log In instead of avatar)
expect(page).to have_link('Log In')
expect(page).not_to have_css('#avatar')
end
end
end