handle invalid credentials

This commit is contained in:
Josh 2017-07-06 11:45:56 -04:00
parent f8d2540665
commit 034c5ba617
2 changed files with 10 additions and 1 deletions

View File

@ -42,6 +42,10 @@ class SessionsController < ApplicationController
end end
def auth_failure def auth_failure
redirect_to '/' if params[:message] == 'invalid_credentials'
redirect_to '/', flash: {danger: 'Invalid login credentials.' }
else
redirect_to '/'
end
end end
end end

View File

@ -20,3 +20,8 @@ Rails.application.config.middleware.use OmniAuth::Builder do
bind_dn: ENV['LDAP_BIND_DN'], bind_dn: ENV['LDAP_BIND_DN'],
password: ENV['LDAP_PASSWORD'] password: ENV['LDAP_PASSWORD']
end end
# Redirect back to login in development mode.
OmniAuth.config.on_failure = Proc.new { |env|
OmniAuth::FailureEndpoint.new(env).redirect_to_failure
}