From 6b0d11ed7a457ef1a338718e2e1819aeb25e943d Mon Sep 17 00:00:00 2001 From: Timo Schilling Date: Tue, 23 Sep 2014 18:42:11 +0200 Subject: [PATCH] =?UTF-8?q?use=20authentication=5Fkeys=20in=20flash=20mess?= =?UTF-8?q?age,=20instead=20of=20static=20=E2=80=98username=E2=80=99=20(fi?= =?UTF-8?q?x=20#3201)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 4 ++-- lib/devise/failure_app.rb | 1 + test/integration/authenticatable_test.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index fa69b16d..26a10f29 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -9,10 +9,10 @@ en: failure: already_authenticated: "You are already signed in." inactive: "Your account is not activated yet." - invalid: "Invalid email or password." + invalid: "Invalid %{authentication_keys} or password." locked: "Your account is locked." last_attempt: "You have one more attempt before your account is locked." - not_found_in_database: "Invalid email or password." + not_found_in_database: "Invalid %{authentication_keys} or password." 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." diff --git a/lib/devise/failure_app.rb b/lib/devise/failure_app.rb index 27c4154e..863b33d6 100644 --- a/lib/devise/failure_app.rb +++ b/lib/devise/failure_app.rb @@ -78,6 +78,7 @@ module Devise options[:resource_name] = scope options[:scope] = "devise.failure" options[:default] = [message] + options[:authentication_keys] = Devise.authentication_keys.join(", ") options = i18n_options(options) I18n.t(:"#{scope}.#{message}", options) diff --git a/test/integration/authenticatable_test.rb b/test/integration/authenticatable_test.rb index 91449fdd..8048390b 100644 --- a/test/integration/authenticatable_test.rb +++ b/test/integration/authenticatable_test.rb @@ -580,7 +580,7 @@ class AuthenticationKeysTest < ActionDispatch::IntegrationTest test 'missing authentication keys cause authentication to abort' do swap Devise, authentication_keys: [:subdomain] do sign_in_as_user - assert_contain "Invalid email or password." + assert_contain "Invalid subdomain or password." assert_not warden.authenticated?(:user) end end