diff --git a/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee b/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee index 49dcd25359..f8d90756b2 100644 --- a/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee +++ b/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee @@ -123,9 +123,7 @@ module.exports = AuthenticationController = ipMatchCheck: (req, user) -> if req.ip != user.lastLoginIp - NotificationsBuilder.ipMatcherAffiliation(user._id, req.ip).create((err) -> - return err - ) + NotificationsBuilder.ipMatcherAffiliation(user._id, req.ip).create() UserUpdater.updateUser user._id.toString(), { $set: { "lastLoginIp": req.ip } } diff --git a/services/web/app/coffee/Features/Project/ProjectController.coffee b/services/web/app/coffee/Features/Project/ProjectController.coffee index e5acd1dfb9..59c0647c19 100644 --- a/services/web/app/coffee/Features/Project/ProjectController.coffee +++ b/services/web/app/coffee/Features/Project/ProjectController.coffee @@ -213,14 +213,9 @@ module.exports = ProjectController = # in v2 add notifications for matching university IPs if Settings.overleaf? - ip = req.headers['x-forwarded-for'] || - req.connection.remoteAddress || - req.socket.remoteAddress UserGetter.getUser user_id, { 'lastLoginIp': 1 }, (error, user) -> - if ip != user.lastLoginIp - NotificationsBuilder.ipMatcherAffiliation(user._id, ip).create((err) -> - return err - ) + if req.ip != user.lastLoginIp + NotificationsBuilder.ipMatcherAffiliation(user._id, req.ip).create() ProjectController._injectProjectOwners projects, (error, projects) -> return next(error) if error?