forked from External/greenlight
		
	handle invalid credentials
This commit is contained in:
		@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user