-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added firerepirts upload, admin, public list
- Loading branch information
cactus
committed
Mar 12, 2015
1 parent
f678dba
commit 2bc2cde
Showing
32 changed files
with
887 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ node_modules | |
temp | ||
.git | ||
s2t.build | ||
public/files | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
|
||
"locale": "en", | ||
|
||
"version" : "1.0.0 alpha", | ||
"version" : "1.0.1 beta", | ||
|
||
"build" : "---should be dynamically assigned", | ||
|
||
|
@@ -50,6 +50,13 @@ | |
"notifications" : { | ||
"portfolioupdate": "[email protected]" | ||
|
||
}, | ||
|
||
"firereports" : { | ||
"contact": "Pablo Delgado Caballero", | ||
"contactEmail" : "[email protected]" | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
var express = require('express'); | ||
var router = express.Router(); | ||
//underscore | ||
var _ = require('lodash'); | ||
|
||
var config = require('config'); | ||
|
||
var passport = require('passport') | ||
, LocalStrategy = require('passport-local').Strategy; | ||
|
||
|
||
var user = require('../services/UserService'); | ||
|
||
|
||
passport.use('local-signin', new LocalStrategy( | ||
{passReqToCallback : true}, // allows us to pass back the request to the callback | ||
function(req,username, password, done) { | ||
|
||
console.log("....trying to authenticate"); | ||
debugger; | ||
|
||
user.findByUsername(username, function (err, user) { | ||
console.log("...in find"); | ||
if (err) { | ||
console.log("...error"); | ||
return done(err); | ||
} | ||
if (!user) { | ||
console.log("...invalid user"); | ||
return done(null, false, { message: 'Unknown user ' + username }); | ||
} | ||
if (user.password != password) { | ||
console.log("...wrong password"); | ||
return done(null, false, { message: 'Invalid password' }); | ||
} | ||
console.log("...[OK]"); | ||
return done(null, user); | ||
|
||
}); | ||
|
||
} | ||
)); | ||
|
||
// Passport session setup. | ||
passport.serializeUser(function(user, done) { | ||
console.log("serializing " + user.username); | ||
done(null, user); | ||
}); | ||
|
||
passport.deserializeUser(function(obj, done) { | ||
console.log("deserializing " + JSON.stringify(obj)); | ||
done(null, obj); | ||
}); | ||
|
||
|
||
|
||
|
||
|
||
|
||
/** passport authetication | ||
*/ | ||
router.post('/', function(req,res,next){ | ||
debugger; | ||
passport.authenticate('local-signin', function(err,user,info){ | ||
if (err) { return next(err); } | ||
if (!user) { return res.render('login'); } | ||
req.logIn(user, function(err) { | ||
if (err) { return next(err); } | ||
console.log("[we are very close :-), req.session.ORIGINAL_URL: "+req.session.ORIGINAL_URL); | ||
var sess = req.session; | ||
sess.AUTH=user.role; | ||
//return res.json({detail: info}); | ||
res.send({AUTH:user.role,ORIGINAL_URL:req.session.ORIGINAL_URL}); | ||
}); | ||
})(req, res, next); | ||
}); | ||
|
||
module.exports = router; | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
var express = require('express'); | ||
var router = express.Router(); | ||
var _ = require('lodash'); | ||
|
||
var config = require('config'); | ||
|
||
|
||
var avService = require('../services/AvailabilityService'); | ||
|
||
|
||
|
||
// | ||
router.get('/', function(req, res) { | ||
//if (!req.session.AUTH){ | ||
if (!req.session.AUTH){ | ||
req.session.ORIGINAL_URL = req.originalUrl; | ||
console.log("no req.session.AUTH found: "); | ||
res.redirect("/login"); | ||
} | ||
else{ | ||
avService.getLatest(function(av){ | ||
|
||
res.locals.availability = av; | ||
res.locals.downtime = avService.getDowntimeYTD(av.unplannedYTD,av.week); | ||
res.locals.targetDowntime = avService.getDowntimeYTD(99.75,52); | ||
res.locals.leftDowntime = avService.getDowntimeYTD(99.75,52); | ||
res.render('dashboard', { title: 's p a c e - dashboards' }); | ||
}); | ||
} | ||
}); | ||
|
||
module.exports = router; | ||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.