Added post login action
This commit is contained in:
parent
dc25b68ec4
commit
dcdf8e9fcb
5
.gitignore
vendored
5
.gitignore
vendored
@ -56,11 +56,14 @@ build-iPhoneSimulator/
|
|||||||
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
||||||
# .rubocop-https?--*
|
# .rubocop-https?--*
|
||||||
|
|
||||||
|
# Ignore local config files
|
||||||
|
config/
|
||||||
|
|
||||||
# Ignore Grunt.js dependencies
|
# Ignore Grunt.js dependencies
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Ignore compiled CSS and JS
|
# Ignore compiled CSS and JS
|
||||||
public/css/
|
public/styles/
|
||||||
public/js/
|
public/js/
|
||||||
|
|
||||||
# SASS compilation cache
|
# SASS compilation cache
|
||||||
|
1
Gemfile
1
Gemfile
@ -5,3 +5,4 @@ gem 'puma', '~> 6.0'
|
|||||||
|
|
||||||
gem 'rerun'
|
gem 'rerun'
|
||||||
|
|
||||||
|
gem 'net-ldap', '~> 0.17'
|
||||||
|
@ -7,6 +7,7 @@ GEM
|
|||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
mustermann (3.0.0)
|
mustermann (3.0.0)
|
||||||
ruby2_keywords (~> 0.0.1)
|
ruby2_keywords (~> 0.0.1)
|
||||||
|
net-ldap (0.17.1)
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.8)
|
||||||
puma (6.0.0)
|
puma (6.0.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
@ -30,6 +31,7 @@ PLATFORMS
|
|||||||
x86_64-linux
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
net-ldap (~> 0.17)
|
||||||
puma (~> 6.0)
|
puma (~> 6.0)
|
||||||
rerun
|
rerun
|
||||||
sinatra (~> 3.0)
|
sinatra (~> 3.0)
|
||||||
|
@ -6,4 +6,21 @@ class AuthController < Sinatra::Base
|
|||||||
}
|
}
|
||||||
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
|
||||||
|
0
app/models/account.rb
Normal file
0
app/models/account.rb
Normal file
@ -1,4 +1,15 @@
|
|||||||
|
$primary-color: #009688
|
||||||
|
$primary-color-highlight: lighten($primary-color, 10%)
|
||||||
|
$accent-color: #795548
|
||||||
|
$accent-color-highlight: lighten($accent-color, 10%)
|
||||||
|
|
||||||
|
$box-shadow-1: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)
|
||||||
|
$box-shadow-2: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)
|
||||||
|
|
||||||
|
$nav-height: 60px
|
||||||
|
|
||||||
body
|
body
|
||||||
|
padding-top: $nav-height
|
||||||
background: lightgrey
|
background: lightgrey
|
||||||
|
|
||||||
#main-nav
|
#main-nav
|
||||||
@ -6,8 +17,9 @@ body
|
|||||||
top: 0
|
top: 0
|
||||||
left: 0
|
left: 0
|
||||||
width: 100%
|
width: 100%
|
||||||
height: 60px
|
height: $nav-height
|
||||||
background: #212121
|
background: #212121
|
||||||
|
box-shadow: $box-shadow-1
|
||||||
clear: float
|
clear: float
|
||||||
|
|
||||||
.nav-left
|
.nav-left
|
||||||
@ -21,3 +33,21 @@ body
|
|||||||
|
|
||||||
li
|
li
|
||||||
display: inline-block
|
display: inline-block
|
||||||
|
color: white
|
||||||
|
font-size: 2rem
|
||||||
|
&:first-child
|
||||||
|
margin-left: 20px
|
||||||
|
a
|
||||||
|
display: block
|
||||||
|
box-sizing: border-box
|
||||||
|
height: $nav-height
|
||||||
|
padding: 12px 15px
|
||||||
|
font-size: 2rem
|
||||||
|
|
||||||
|
#main-wrapper
|
||||||
|
margin-top: 25px
|
||||||
|
padding: 20px 28px
|
||||||
|
background: white
|
||||||
|
border-radius: 5px
|
||||||
|
box-shadow: $box-shadow-2
|
||||||
|
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'sinatra/base'
|
require 'sinatra/base'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
require_relative 'app/settings.rb'
|
require_relative 'app/settings.rb'
|
||||||
|
|
||||||
|
defaultCnf = YAML::load_file(File.join(__dir__, 'config/defaults.yaml'))
|
||||||
|
cnf = YAML::load_file(File.join(__dir__, 'config/local.yaml'))
|
||||||
|
cnf = defaultCnf.merge(cnf)
|
||||||
|
|
||||||
|
require 'net/ldap'
|
||||||
|
|
||||||
require_relative 'app/controllers/index.rb'
|
require_relative 'app/controllers/index.rb'
|
||||||
require_relative 'app/controllers/auth.rb'
|
require_relative 'app/controllers/auth.rb'
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
body{background:#d3d3d3}#main-nav{position:fixed;top:0;left:0;width:100%;height:60px;background:#212121;clear:float}#main-nav .nav-left{float:left}#main-nav .nav-right{float:right}#main-nav .nav-menu ul{list-style:none}#main-nav .nav-menu li{display:inline-block}
|
|
||||||
/*# sourceMappingURL=darkmeyer.css.map */
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"mappings": "AAAA,IAAI,CACF,UAAU,CAAE,OAAS,CAEvB,SAAS,CACP,QAAQ,CAAE,KAAK,CACf,GAAG,CAAE,CAAC,CACN,IAAI,CAAE,CAAC,CACP,KAAK,CAAE,IAAI,CACX,MAAM,CAAE,IAAI,CACZ,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,KAAK,CAEZ,mBAAS,CACP,KAAK,CAAE,IAAI,CACb,oBAAU,CACR,KAAK,CAAE,KAAK,CAGZ,sBAAE,CACA,UAAU,CAAE,IAAI,CAElB,sBAAE,CACA,OAAO,CAAE,YAAY",
|
|
||||||
"sources": ["../../assets/sass/darkmeyer.sass"],
|
|
||||||
"names": [],
|
|
||||||
"file": "darkmeyer.css"
|
|
||||||
}
|
|
11
views/account/view.erb
Normal file
11
views/account/view.erb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<div class="row">
|
||||||
|
<div class="twelve columns">
|
||||||
|
<ul>
|
||||||
|
<li>Username: <%= account.username %></li>
|
||||||
|
<li>Email address: <%= account.mail %></li>
|
||||||
|
<li>Display name: <%= account.displayName %></li>
|
||||||
|
<li>UID number: <%= account.uidNumber %></li>
|
||||||
|
<li>Home directory: <%= account.homeDirectory %></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -14,7 +14,7 @@
|
|||||||
<div class="three columns"><p></p></div>
|
<div class="three columns"><p></p></div>
|
||||||
<div class="six columns">
|
<div class="six columns">
|
||||||
<label for="auth_password">Password:</label>
|
<label for="auth_password">Password:</label>
|
||||||
<input id="auth_password" class="u-full-width" type="text" name="auth_password" required>
|
<input id="auth_password" class="u-full-width" type="password" name="auth_password" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="twelve columns">
|
<div class="twelve columns">
|
||||||
<h1>Welcome to Webdap!</h1>
|
<h1>Welcome to Webdap!</h1>
|
||||||
<p>You can use this site to manage your network account. <a href="/auth/login">Click here</a> to login.</p>
|
<p>You can use this site to manage your network account. <i class="fa-solid fa-address-book"></i></p>
|
||||||
|
|
||||||
|
<p><a href="/auth/login">Click here</a> to login.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title><%= title %> | Webdap</title>
|
<title><%= title %> | Webdap</title>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
|
||||||
<link rel="stylesheet" href="/styles/darkmeyer.css">
|
<link rel="stylesheet" href="/styles/darkmeyer.css">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
|
||||||
<script src="/js/meiyerditch.js"></script>
|
<script src="/js/meiyerditch.js"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user