I followed this question Devise redirect after login fail and it works great, but I am getting a flash notice telling me that I need to login to continue, and the message I need is that the password or email is invalid. So I added the flash notice in the CustomFailure like this:
class CustomFailure < Devise::FailureApp
def redirect_url
root_path
end
def respond
if http_auth?
http_auth
else
flash[:error] = I18n.t(:invalid, :scope => [ :devise, :failure ])
redirect
end
end
end
and now it's showing me both messages, invalid password and unauthenticated, how can I eliminate the unauthenticated message?