Errores solucionados
This commit is contained in:
parent
02d0e167a0
commit
8cd312e145
|
@ -64,7 +64,7 @@ function vnAppInterceptor($q, $rootScope, $window, logger, $translate, $cookies)
|
||||||
let location = $window.location;
|
let location = $window.location;
|
||||||
let continueUrl = location.pathname + location.search + location.hash;
|
let continueUrl = location.pathname + location.search + location.hash;
|
||||||
continueUrl = encodeURIComponent(continueUrl);
|
continueUrl = encodeURIComponent(continueUrl);
|
||||||
$window.location = `/auth?continue=${continueUrl}`;
|
$window.location = `/auth/?apiKey=salix&continue=${continueUrl}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.showError(error);
|
logger.showError(error);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
|
let models = app.models;
|
||||||
|
|
||||||
app.get('/', function (req, res) {
|
app.get('/', function (req, res) {
|
||||||
let token = req.cookies.vnToken;
|
let token = req.cookies.vnToken;
|
||||||
validateToken(token, function(isValid) {
|
validateToken(token, function(isValid) {
|
||||||
|
@ -36,13 +38,13 @@ module.exports = function (app) {
|
||||||
|
|
||||||
app.get('/logout', function (req, res) {
|
app.get('/logout', function (req, res) {
|
||||||
let token = req.cookies.vnToken;
|
let token = req.cookies.vnToken;
|
||||||
app.models.User.logout(token, function(err) {
|
models.User.logout(token, function() {
|
||||||
redirectToAuth(res);
|
redirectToAuth(res);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function validateToken(tokenId, cb) {
|
function validateToken(tokenId, cb) {
|
||||||
app.models.AccessToken.findById(tokenId, function(err, token) {
|
models.AccessToken.findById(tokenId, function(err, token) {
|
||||||
if (token) {
|
if (token) {
|
||||||
token.validate (function (err, isValid) {
|
token.validate (function (err, isValid) {
|
||||||
cb(isValid === true, token);
|
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){
|
if(roles){
|
||||||
var acl = {
|
var acl = {
|
||||||
userProfile: {},
|
userProfile: {},
|
||||||
|
@ -79,7 +81,7 @@ module.exports = function (app) {
|
||||||
acl.roles[rol.name] = true;
|
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 = userProfile;
|
||||||
acl.userProfile.id = userProfile.id;
|
acl.userProfile.id = userProfile.id;
|
||||||
acl.userProfile.username = userProfile.username;
|
acl.userProfile.username = userProfile.username;
|
||||||
|
|
Loading…
Reference in New Issue