Modernized the app with app structure from Stage Manager

This commit is contained in:
2023-03-31 11:52:37 -04:00
parent 4568733655
commit 72bb25a6ad
16 changed files with 285 additions and 78 deletions

View File

@ -1,26 +1,33 @@
class AuthController < Sinatra::Base
# frozen_string_literal: true
get '/login' do
erb :'auth/login', :locals => {
:title => 'Login to your account'
}
end
require 'net/ldap'
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
class Webdap
# Handles /auth routes
class AuthController
get '/login' do
erb :'auth/login', locals: {
title: 'Login to your account',
}
end
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
end

View File

@ -1,9 +1,14 @@
class IndexController < Sinatra::Base
# frozen_string_literal: true
class Webdap
# Handles top-level routes
class IndexController
get '/' do
erb :index, locals: {
title: 'Home',
}
end
get '/' do
erb :index, :locals => {
:title => 'Home'
}
end
end