use authentication_keys in flash message, instead of static ‘username’ (fix #3201)
This commit is contained in:
parent
258a29636b
commit
6b0d11ed7a
|
@ -9,10 +9,10 @@ en:
|
||||||
failure:
|
failure:
|
||||||
already_authenticated: "You are already signed in."
|
already_authenticated: "You are already signed in."
|
||||||
inactive: "Your account is not activated yet."
|
inactive: "Your account is not activated yet."
|
||||||
invalid: "Invalid email or password."
|
invalid: "Invalid %{authentication_keys} or password."
|
||||||
locked: "Your account is locked."
|
locked: "Your account is locked."
|
||||||
last_attempt: "You have one more attempt before 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."
|
timeout: "Your session expired. Please sign in again to continue."
|
||||||
unauthenticated: "You need to sign in or sign up before continuing."
|
unauthenticated: "You need to sign in or sign up before continuing."
|
||||||
unconfirmed: "You have to confirm your email address before continuing."
|
unconfirmed: "You have to confirm your email address before continuing."
|
||||||
|
|
|
@ -78,6 +78,7 @@ module Devise
|
||||||
options[:resource_name] = scope
|
options[:resource_name] = scope
|
||||||
options[:scope] = "devise.failure"
|
options[:scope] = "devise.failure"
|
||||||
options[:default] = [message]
|
options[:default] = [message]
|
||||||
|
options[:authentication_keys] = Devise.authentication_keys.join(", ")
|
||||||
options = i18n_options(options)
|
options = i18n_options(options)
|
||||||
|
|
||||||
I18n.t(:"#{scope}.#{message}", options)
|
I18n.t(:"#{scope}.#{message}", options)
|
||||||
|
|
|
@ -580,7 +580,7 @@ class AuthenticationKeysTest < ActionDispatch::IntegrationTest
|
||||||
test 'missing authentication keys cause authentication to abort' do
|
test 'missing authentication keys cause authentication to abort' do
|
||||||
swap Devise, authentication_keys: [:subdomain] do
|
swap Devise, authentication_keys: [:subdomain] do
|
||||||
sign_in_as_user
|
sign_in_as_user
|
||||||
assert_contain "Invalid email or password."
|
assert_contain "Invalid subdomain or password."
|
||||||
assert_not warden.authenticated?(:user)
|
assert_not warden.authenticated?(:user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue