Show a "Unable to login" message in browser when a user is unable to login. (#17261)

* implementation and modify spec

* oops! correct unwanted change

* nudge Travis

* nudge Travis
This commit is contained in:
Arit Amana 2022-04-13 09:00:56 -04:00 committed by GitHub
parent 94ab24ba34
commit 240893401d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View file

@ -8,10 +8,10 @@ en:
failure:
already_authenticated: You are already signed in.
inactive: Your account is not activated yet.
invalid: Invalid %{authentication_keys} or password.
invalid: Unable to login.
last_attempt: You have one more attempt before your account is locked.
locked: Your account is locked.
not_found_in_database: Invalid %{authentication_keys} or password.
locked: Unable to login.
not_found_in_database: Unable to login.
timeout: Your session expired. Please sign in again to continue.
unauthenticated: You need to sign in or sign up before continuing.
unconfirmed: You have to confirm your email address before continuing.
@ -61,4 +61,4 @@ en:
not_locked: was not locked
not_saved:
one: '1 error prohibited this %{resource} from being saved:'
other: "%{count} errors prohibited this %{resource} from being saved:"
other: '%{count} errors prohibited this %{resource} from being saved:'

View file

@ -72,7 +72,7 @@ RSpec.describe "Authenticating with Email" do
click_button("Continue", match: :first)
expect(page).to have_current_path("/users/sign_in")
expect(page).to have_text("Invalid Email or password.")
expect(page).to have_text("Unable to login.")
end
end
end

View file

@ -20,15 +20,15 @@ RSpec.describe "Authenticating with a password" do
it "displays an error when the email address is wrong" do
submit_login_form("wrong@example.com", password)
expect(page).to have_text("Invalid Email or password.")
expect(page).to have_text("Unable to login.")
end
it "displays an error when the password is wrong" do
submit_login_form(user.email, "wr0ng")
expect(page).to have_text("Invalid Email or password.")
expect(page).to have_text("Unable to login.")
end
it "sends an email with the unlock link if the uset gets locked out", :aggregate_failures do
it "sends an email with the unlock link if the user gets locked out", :aggregate_failures do
allow(User).to receive(:maximum_attempts).and_return(1)
assert_enqueued_with(job: Devise.mailer.delivery_job) do