From 8cd312e1452ed2c0c5d3ca2b92b9a47edfd7f64d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2017 15:39:16 +0200 Subject: [PATCH] Errores solucionados --- client/salix/src/components/app/app.js | 2 +- services/salix/server/boot/routes.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index 5c9af143a..c9a828dae 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -64,7 +64,7 @@ function vnAppInterceptor($q, $rootScope, $window, logger, $translate, $cookies) let location = $window.location; let continueUrl = location.pathname + location.search + location.hash; continueUrl = encodeURIComponent(continueUrl); - $window.location = `/auth?continue=${continueUrl}`; + $window.location = `/auth/?apiKey=salix&continue=${continueUrl}`; } logger.showError(error); diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 235b134aa..aa509b034 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -1,4 +1,6 @@ module.exports = function (app) { + let models = app.models; + app.get('/', function (req, res) { let token = req.cookies.vnToken; validateToken(token, function(isValid) { @@ -36,13 +38,13 @@ module.exports = function (app) { app.get('/logout', function (req, res) { let token = req.cookies.vnToken; - app.models.User.logout(token, function(err) { + models.User.logout(token, function() { redirectToAuth(res); }); }); function validateToken(tokenId, cb) { - app.models.AccessToken.findById(tokenId, function(err, token) { + models.AccessToken.findById(tokenId, function(err, token) { if (token) { token.validate (function (err, isValid) { cb(isValid === true, token); @@ -67,7 +69,7 @@ module.exports = function (app) { } }] }; - app.models.RoleMapping.find(query, function(err, roles){ + models.RoleMapping.find(query, function(_, roles){ if(roles){ var acl = { userProfile: {}, @@ -79,7 +81,7 @@ module.exports = function (app) { acl.roles[rol.name] = true; } }); - app.models.User.findById(token.userId, function(_, userProfile){ + models.User.findById(token.userId, function(_, userProfile){ //acl.userProfile = userProfile; acl.userProfile.id = userProfile.id; acl.userProfile.username = userProfile.username;