Fixed authentication; fixed configuration loading
This commit is contained in:
@ -13,12 +13,11 @@ class Webdap
|
||||
end
|
||||
|
||||
post '/login' do
|
||||
ldap = Net::LDAP.new
|
||||
ldap.host = cnf['ldap']['server_url']
|
||||
ldap.port = 389
|
||||
ldap.auth(params[:login_username], params[:login_password])
|
||||
if ldap.bind()
|
||||
session['ldap_uid'] = params[:username]
|
||||
ldap = Net::LDAP.new(:host => $conf.get('ldap.server_url'), :port => 389)
|
||||
ldap_bind_dn = "#{$conf.get('ldap.user_uid_attr')}=#{params[:auth_username]},#{$conf.get('ldap.user_ou')}"
|
||||
|
||||
if ldap.bind(:method => :simple, :username => ldap_bind_dn, :password => params[:auth_password])
|
||||
session['ldap_uid'] = params[:auth_username]
|
||||
redirect '/account/view'
|
||||
else
|
||||
# Authentication failure
|
||||
|
@ -7,6 +7,7 @@ class Webdap
|
||||
get '/' do
|
||||
erb :index, locals: {
|
||||
title: 'Home',
|
||||
server: $conf.get('ldap.server_url'),
|
||||
}
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user