Merge branch 'NamPNQ-master' into master
See https://github.com/timvisee/send/pull/94
This commit is contained in:
commit
000854104f
@ -1,6 +1,7 @@
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const storage = require('../storage');
|
const storage = require('../storage');
|
||||||
|
const config = require('../config');
|
||||||
const fxa = require('../fxa');
|
const fxa = require('../fxa');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -70,10 +71,11 @@ module.exports = {
|
|||||||
const token = authHeader.split(' ')[1];
|
const token = authHeader.split(' ')[1];
|
||||||
req.user = await fxa.verify(token);
|
req.user = await fxa.verify(token);
|
||||||
}
|
}
|
||||||
if (req.user) {
|
|
||||||
next();
|
if (config.fxa_required && !req.user) {
|
||||||
} else {
|
|
||||||
res.sendStatus(401);
|
res.sendStatus(401);
|
||||||
|
} else {
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user