Added post login action
This commit is contained in:
@ -6,4 +6,21 @@ class AuthController < Sinatra::Base
|
||||
}
|
||||
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]
|
||||
redirect '/account/view'
|
||||
else
|
||||
# Authentication failure
|
||||
erb :'auth/login', :locals => {
|
||||
:title => 'Login to your account',
|
||||
:fail => true
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user