added passport
This commit is contained in:
parent
a421a61086
commit
7a781e4335
@ -1,4 +1,4 @@
|
||||
module.exports = function(app, sql, app_cfg) {
|
||||
module.exports = function(app, sql, app_cfg, passport) {
|
||||
|
||||
// get index
|
||||
app.get('/', function(req, res) {
|
||||
@ -12,7 +12,8 @@ module.exports = function(app, sql, app_cfg) {
|
||||
title: 'Startseite',
|
||||
list_wache: data_wachen,
|
||||
list_traeger: data_traeger,
|
||||
list_kreis: data_kreis
|
||||
list_kreis: data_kreis,
|
||||
user:req.user
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -34,7 +35,8 @@ module.exports = function(app, sql, app_cfg) {
|
||||
title: 'Alarmmonitor',
|
||||
wachen_id: parmeter_id,
|
||||
data_wache: ' ' + result.name,
|
||||
app_id: app_cfg.global.app_id
|
||||
app_id: app_cfg.global.app_id,
|
||||
user:req.user
|
||||
});
|
||||
} else {
|
||||
var err = new Error('Wache '+ parmeter_id +' nicht vorhanden');
|
||||
@ -48,31 +50,48 @@ module.exports = function(app, sql, app_cfg) {
|
||||
// get /ueber
|
||||
app.get('/ueber', function(req, res) {
|
||||
res.render('ueber', {
|
||||
title: 'Über'
|
||||
title: 'Über',
|
||||
user:req.user
|
||||
});
|
||||
});
|
||||
|
||||
// get /uhr
|
||||
app.get('/test_clock', function(req, res) {
|
||||
res.render('test_clock', {
|
||||
title: 'Test Uhr'
|
||||
title: 'Test Uhr',
|
||||
user:req.user
|
||||
});
|
||||
});
|
||||
|
||||
// get /test_tableau
|
||||
app.get('/test_tableau', function(req, res) {
|
||||
res.render('test_wachalarm', {
|
||||
title: 'Test Wachalarm'
|
||||
title: 'Test Wachalarm',
|
||||
user:req.user
|
||||
});
|
||||
});
|
||||
|
||||
// get /login
|
||||
app.get('/login', function(req, res) {
|
||||
res.render('login', {
|
||||
title: 'Login'
|
||||
title: 'Login',
|
||||
user:req.user
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/login', passport.authenticate('local', {
|
||||
failureRedirect: '/'
|
||||
}), function(req, res) {
|
||||
res.redirect('/');
|
||||
}
|
||||
);
|
||||
|
||||
app.post('/logout', function(req, res) {
|
||||
req.session.destroy(function(err) {
|
||||
res.redirect('/');
|
||||
})
|
||||
});
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user