Skip to content

Commit

Permalink
Merge pull request #3198 from americodls/fixes-flash-banners-persisti…
Browse files Browse the repository at this point in the history
…ng-for-too-long

Fixes flash banners persisting for too long
  • Loading branch information
simi committed Aug 28, 2022
2 parents dee7118 + bb4d485 commit f4e4bf7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/sessions_controller.rb
Expand Up @@ -35,7 +35,7 @@ def authenticate
session[:verification] = Time.current + Gemcutter::PASSWORD_VERIFICATION_EXPIRY
redirect_to session.delete(:redirect_uri) || root_path
else
flash[:alert] = t("profiles.request_denied")
flash.now[:alert] = t("profiles.request_denied")
render :verify, status: :unauthorized
end
end
Expand Down
13 changes: 13 additions & 0 deletions test/integration/owner_test.rb
Expand Up @@ -120,6 +120,19 @@ class OwnerTest < SystemTest
assert page.has_selector? "#flash_alert", text: "This request was denied. We could not verify your password."
end

test "incorrect password error does not persist after correct password" do
visit rubygem_path(@rubygem)
click_link "Ownership"
assert page.has_css? "#verify_password_password"
fill_in "Password", with: "wrong password"
click_button "Confirm"
assert page.has_selector? "#flash_alert", text: "This request was denied. We could not verify your password."

fill_in "Password", with: PasswordHelpers::SECURE_TEST_PASSWORD
click_button "Confirm"
assert page.has_no_selector? "#flash_alert"
end

test "clicking on confirmation link confirms the account" do
@unconfirmed_ownership = create(:ownership, :unconfirmed, rubygem: @rubygem)
confirmation_link = confirm_rubygem_owners_url(@rubygem, token: @unconfirmed_ownership.token)
Expand Down

0 comments on commit f4e4bf7

Please sign in to comment.