From 3b73d979310ba8b4b8a2a08e638afa2fa463e2cc Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 22 Sep 2016 11:33:38 +0100 Subject: [PATCH] Use `getLoggedInUserId` --- .../coffee/Features/User/UserInfoController.coffee | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/services/web/app/coffee/Features/User/UserInfoController.coffee b/services/web/app/coffee/Features/User/UserInfoController.coffee index edaf836c80..92f111bda7 100644 --- a/services/web/app/coffee/Features/User/UserInfoController.coffee +++ b/services/web/app/coffee/Features/User/UserInfoController.coffee @@ -3,12 +3,14 @@ logger = require("logger-sharelatex") UserDeleter = require("./UserDeleter") UserUpdater = require("./UserUpdater") sanitize = require('sanitizer') +AuthenticationController = require('../Authentication/AuthenticationController') module.exports = UserController = getLoggedInUsersPersonalInfo: (req, res, next = (error) ->) -> - logger.log user: req.user, "reciving request for getting logged in users personal info" - return next(new Error("User is not logged in")) if !req.user? - UserGetter.getUser req.user._id, { + user_id = AuthenticationController.getLoggedInUserId(req) + logger.log user_id: user_id, "reciving request for getting logged in users personal info" + return next(new Error("User is not logged in")) if !user_id? + UserGetter.getUser user_id, { first_name: true, last_name: true, role:true, institution:true, email: true, signUpDate: true @@ -38,6 +40,3 @@ module.exports = UserController = role: user.role institution: user.institution } - - -