Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 05bda68

Browse files
committed
cleaning up actions; adding better web service friendly req logging. Fixing spaces in crowd authentication.
1 parent 7c6021d commit 05bda68

19 files changed

Lines changed: 59 additions & 27 deletions

config/settings.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
'use strict';
2-
var mongoose = require('mongoose');
3-
41
module.exports = function () {
52

63
var getSetting = function (setting) {
@@ -28,9 +25,9 @@ module.exports = function () {
2825

2926
port: getSetting('PORT'),
3027
cookieSecret: getSetting('COOKIE_SECRET'),
31-
log: 'console',
3228
sessionSecret: getSetting('SESSION_SECRET'),
33-
29+
log: 'console',
30+
3431
hostileTtl: 900000,
3532
memberTtl: 60000,
3633
armadaTtl: 43200000,

lib/actions/createAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = function (armadaService, memberService, sessionService, eventSe
33
var pub = {};
44

55
pub.run = function (req, res) {
6-
logger.log('Processing \'create\' request', 0);
6+
logger.processing(req);
77

88
sessionService.checkIfValid(req, function (error, isValid) {
99
if (isValid) {

lib/actions/indexAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = function (logger) {
33
var pub = {};
44

55
pub.run = function (req, res) {
6-
logger.log('Processing \'index\' request', 0)
6+
logger.processing(req);
77
res.render('main', { user: req.user });
88
};
99

lib/actions/joinAction.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module.exports = function (errorResponse, successResponse, headerParser, memberS
33
var pub = {};
44

55
pub.run = function (req, res) {
6+
logger.processing(req);
7+
68
if (req.params.armadaPassword ) {
79
logger.log('Processing \'join\' request with password', 0)
810
} else {

lib/actions/leaveAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = function (successResponse, errorResponse, memberService, eventS
33
var pub = {};
44

55
pub.run = function (req, res) {
6-
logger.log('Processing \'leave\' request', 0);
6+
logger.processing(req);
77

88
sessionService.checkIfValid(req, function (error, isValid) {
99
if (!isValid) {

lib/actions/linkAction.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ module.exports = function (logger) {
33
var pub = {};
44

55
pub.run = function (req, res) {
6-
logger.log('Processing \'link\' request', 0)
6+
logger.processing(req);
7+
78
res.render('link', { user: req.user, linked: req.session.linked, error: req.flash('error') });
89
};
910

lib/actions/loginAction.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
module.exports = function (logger) {
1+
module.exports = function (passport, logger) {
22

33
var pub = {};
44

5+
6+
pub.authenticate = function (req, res) {
7+
logger.processing(req);
8+
logger.log('trying to passport')
9+
passport.authenticate('atlassian-crowd', { failureRedirect:'/login', failureFlash:"Invalid username or password." })
10+
res.redirect('/link');
11+
};
12+
513
pub.run = function (req, res) {
6-
logger.log('Processing \'login\' request', 0);
14+
logger.processing(req);
15+
716
res.render('login', { user: req.user, error: req.flash('error') });
817
};
918

lib/actions/logoutAction.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = function (logger) {
2+
3+
var pub = {};
4+
5+
pub.run = function (req, res) {
6+
logger.processing(req);
7+
8+
if (req.session.passport.user) {
9+
req.flash('error', 'Logging out pilot ' + req.session.passport.user);
10+
}
11+
12+
req.logout();
13+
res.redirect('/');
14+
};
15+
16+
return pub;
17+
};

lib/actions/pollAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ module.exports = function (successResponse, errorResponse, headerParser, session
103103
};
104104

105105
pub.run = function (req, res) {
106-
logger.log('Processing \'poll\' request', 0);
106+
logger.processing(req);
107107

108108
memberService.getByKey(req.session.memberKey, function (error, oldState) {
109109
if (error) return errorResponse.respond(req, res, 'get', error);

lib/actions/postDetailsAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function (hostileService, eventService, headerParser, errorResp
1616
};
1717

1818
pub.run = function (req, res) {
19-
logger.log('Processing post \'details\' request', 0);
19+
logger.processing(req);
2020

2121
var pilot = req.body.scanData;
2222

0 commit comments

Comments
 (0)