Added post login action

This commit is contained in:
2022-12-10 18:55:58 -05:00
parent dc25b68ec4
commit dcdf8e9fcb
13 changed files with 78 additions and 13 deletions

View File

@ -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

0
app/models/account.rb Normal file
View File