Disable check user when fxa is not enabled
This commit is contained in:
parent
0ac1eeed2c
commit
1a0ddf9a05
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
const assert = require('assert');
|
||||
const crypto = require('crypto');
|
||||
const storage = require('../storage');
|
||||
const config = require('../config');
|
||||
const fxa = require('../fxa');
|
||||
|
||||
module.exports = {
|
||||
|
@ -70,10 +71,11 @@ module.exports = {
|
|||
const token = authHeader.split(' ')[1];
|
||||
req.user = await fxa.verify(token);
|
||||
}
|
||||
if (req.user) {
|
||||
next();
|
||||
} else {
|
||||
|
||||
if (config.fxa_required && !req.user) {
|
||||
res.sendStatus(401);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue