Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change failure key for missing database resource to :invalid_email

  • Loading branch information...
commit 130d68419857f3ba0cdc75fafbf65e6e96948797 1 parent ffab77c
Gabe Martin-Dempesy authored
2  config/locales/en.yml
View
@@ -18,8 +18,8 @@ en:
unauthenticated: 'You need to sign in or sign up before continuing.'
unconfirmed: 'You have to confirm your account before continuing.'
locked: 'Your account is locked.'
- nonexistent: 'Invalid email or password.'
invalid: 'Invalid email or password.'
+ invalid_email: 'Invalid email or password.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
inactive: 'Your account was not activated yet.'
2  lib/devise/strategies/database_authenticatable.rb
View
@@ -6,7 +6,7 @@ module Strategies
class DatabaseAuthenticatable < Authenticatable
def authenticate!
resource = valid_password? && mapping.to.find_for_database_authentication(authentication_hash)
- return fail(:nonexistent) unless resource
+ return fail(:invalid_email) unless resource
if validate(resource){ resource.valid_password?(password) }
resource.after_database_authentication
12 test/integration/database_authenticatable_test.rb
View
@@ -53,12 +53,14 @@ class DatabaseAuthenticationTest < ActionController::IntegrationTest
end
test 'sign in with invalid email should return to sign in form with error message' do
- sign_in_as_admin do
- fill_in 'email', :with => 'wrongemail@test.com'
- end
+ store_translations :en, :devise => { :failure => { :admin => { :invalid_email => 'Invalid email address' } } } do
+ sign_in_as_admin do
+ fill_in 'email', :with => 'wrongemail@test.com'
+ end
- assert_contain 'Invalid email or password'
- assert_not warden.authenticated?(:admin)
+ assert_contain 'Invalid email address'
+ assert_not warden.authenticated?(:admin)
+ end
end
test 'sign in with invalid pasword should return to sign in form with error message' do
Please sign in to comment.
Something went wrong with that request. Please try again.