DRY req props that depend on auth (fix #6727) (#6731)

* DRY req props that depend on auth (fix #6727)

authentication leads to req.loggedIn and req.uid being set. However, a
later authentication event might outdate them. Here, I create one
function for setting those properties, and make sure it also is called
on the `action:middleware.authenticate` hook, which would be such an
authentication event. If there are other places, those should be added
as well.

* fix lint errors

* fix lint error

* change exports
This commit is contained in:
LudwikJaniuk
2018-09-04 15:43:33 +02:00
committed by Barış Soner Uşaklı
parent 3e1b007f9f
commit c7f3b76b4e
3 changed files with 20 additions and 16 deletions

View File

@@ -8,7 +8,7 @@ var groups = require('../groups');
var user = require('../user');
var helpers = require('./helpers');
var groupsController = {};
var groupsController = module.exports;
groupsController.list = function (req, res, next) {
var sort = req.query.sort || 'alpha';
@@ -177,5 +177,3 @@ groupsController.uploadCover = function (req, res, next) {
res.json([{ url: image.url }]);
});
};
module.exports = groupsController;