Skip to content

Commit

Permalink
Fixed AD check bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Petessss authored and Petessss committed Jun 8, 2017
1 parent d4bc23e commit 42f029e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions routes/basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@

end
elsif user
if options.ldap
if config_options["ldap"].to_s == "true"
#try AD authentication
usern = params[:username]
data = url_escape_hash(request.POST)
if usern == "" or params[:password] == ""
redirect to("/")
end

user = "#{options.domain}\\#{data["username"]}"
ldap = Net::LDAP.new :host => "#{options.dc}", :port => 636, :encryption => :simple_tls, :auth => {:method => :simple, :username => user, :password => params[:password]}
user = "#{config_options["ldap_domain"]}\\#{data["username"]}"
ldap = Net::LDAP.new :host => "#{config_options["ldap_dc"]}", :port => 636, :encryption => :simple_tls, :auth => {:method => :simple, :username => user, :password => params[:password]}

if ldap.bind
# replace the session in the session table
Expand Down

0 comments on commit 42f029e

Please sign in to comment.