Skip to content

Commit

Permalink
Merge pull request #416 from not-an-aardvark/session_state_info
Browse files Browse the repository at this point in the history
Improved logging and add correct timezone
  • Loading branch information
AlMcKinlay committed Nov 23, 2015
2 parents 64a6dc2 + 3a17d48 commit 024cb5b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions api/controllers/AuthController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,18 @@ module.exports = {
},

callback: function (req, res) {
if (req.query.state !== req.session.state) {
console.log("Warning: A user was redirected to the reddit callback, but did not have a valid session state.");
return res.forbidden();
}
passport.authenticate('reddit',
{
state: req.session.state,
duration: 'permanent',
failureRedirect: '/login'
},
function (err, user) {
if (req.query.state !== req.session.state) {
console.log("Warning: A user was redirected to the reddit callback, but does not have a valid session state.");
console.log("The code in the request belongs to /u/" + user.name + '.');
return res.forbidden();
}
var url = req.session.redirectUrl ? req.session.redirectUrl : '/';
req.session.redirectUrl = "";
req.logIn(user, function (err) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FlairHQ",
"version": "2.2.0",
"version": "2.2.1",
"description": "A project to allow easy adding of flair applications for subreddits (focusing initially on /r/pokemontrades) and easy moderation for moderators.",
"scripts": {
"start": "node ./node_modules/sails/bin/sails.js lift"
Expand Down
2 changes: 1 addition & 1 deletion views/search/logs.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/u/{{result.user}}
</h4>
<p class="list-group-iitem-text">
{{result.content}}. {{result.createdAt | date:'yyyy-MM-dd HH:mm:ss'}} UTC
{{result.content}}. {{result.createdAt | date:'yyyy-MM-dd HH:mm:ss UTCZ'}}
</p>
</a>
<a class="list-group-item" ng-if="!searching"
Expand Down

0 comments on commit 024cb5b

Please sign in to comment.