24
1
Fork 0

Merge branch 'NamPNQ-master' into master

See https://github.com/timvisee/send/pull/94
This commit is contained in:
timvisee 2022-07-04 18:40:45 +02:00
commit 000854104f
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
1 changed files with 5 additions and 3 deletions

View File

@ -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();
}
}
};