mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Use getLoggedInUserId
This commit is contained in:
parent
64c9a3ae18
commit
3b73d97931
1 changed files with 5 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue