Fixed sandbox. Multiple tabs work now.
WiP on selectable mosaico templates. TODO: Make files always point to trusted URL, such that we don't have to rebase them. They are public anyway. The same goes for mosaico endpoints: /mosaico/templates and /mosaico/img
This commit is contained in:
parent
a4ee1534cc
commit
7788b0bc67
79 changed files with 724 additions and 390 deletions
|
@ -116,16 +116,22 @@ module.exports.authByAccessToken = (req, res, next) => {
|
|||
};
|
||||
|
||||
module.exports.tryAuthByRestrictedAccessToken = (req, res, next) => {
|
||||
if (req.cookies.restricted_access_token) {
|
||||
users.getByRestrictedAccessToken(req.cookies.restricted_access_token).then(user => {
|
||||
req.user = user;
|
||||
next();
|
||||
}).catch(err => {
|
||||
next();
|
||||
});
|
||||
} else {
|
||||
const pathComps = req.url.split('/');
|
||||
|
||||
pathComps.shift();
|
||||
const restrictedAccessToken = pathComps.shift();
|
||||
pathComps.unshift('');
|
||||
|
||||
const url = pathComps.join('/');
|
||||
|
||||
req.url = url;
|
||||
|
||||
users.getByRestrictedAccessToken(restrictedAccessToken).then(user => {
|
||||
req.user = user;
|
||||
next();
|
||||
}
|
||||
}).catch(err => {
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.setup = app => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue