Skip to content

Commit

Permalink
Support alternate sign in error message when email record does not exist
Browse files Browse the repository at this point in the history
By default, the nonexistent error is still identical to the :invalid
message, and must be customized by the developer to implement.
  • Loading branch information
Gabe Martin-Dempesy committed Nov 18, 2012
1 parent 397fce1 commit cde2229
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ 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.'
nonexitent: 'Invalid email or password.'
invalid: 'Invalid email or password.'
invalid_token: 'Invalid authentication token.'
timeout: 'Your session expired, please sign in again to continue.'
Expand Down
2 changes: 1 addition & 1 deletion lib/devise/strategies/database_authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Strategies
class DatabaseAuthenticatable < Authenticatable
def authenticate!
resource = valid_password? && mapping.to.find_for_database_authentication(authentication_hash)
return fail(:invalid) unless resource
return fail(:nonexitent) unless resource

if validate(resource){ resource.valid_password?(password) }
resource.after_database_authentication
Expand Down

0 comments on commit cde2229

Please sign in to comment.