use authentication_keys in flash message, instead of static ‘username’ (fix #3201)

This commit is contained in:
Timo Schilling 2014-09-23 18:42:11 +02:00
parent 258a29636b
commit 6b0d11ed7a
3 changed files with 4 additions and 3 deletions

View File

@ -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."

View File

@ -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)

View File

@ -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