notifications route; added middleware.authenticate to user/uploadpicture api route

This commit is contained in:
psychobunny
2014-03-03 12:30:27 -05:00
parent 5b8e8e4b67
commit 94aeb3ab22
4 changed files with 19 additions and 22 deletions

View File

@@ -372,10 +372,6 @@ accountsController.accountSettings = function(req, res, next) {
};
accountsController.uploadPicture = function (req, res, next) {
if (!req.user) {
return userNotAllowed();
}
var uploadSize = parseInt(meta.config.maximumProfileImageSize, 10) || 256;
if (req.files.userPhoto.size > uploadSize * 1024) {
return res.json({
@@ -473,4 +469,18 @@ accountsController.uploadPicture = function (req, res, next) {
});
};
accountsController.getNotifications = function(req, res, next) {
user.notifications.getAll(req.user.uid, null, null, function(err, notifications) {
if (res.locals.isAPI) {
res.json({
notifications: notifications
});
} else {
res.render('notifications', {
notifications: notifications
});
}
});
};
module.exports = accountsController;