Skip to content

Commit

Permalink
Merge branch 'NamPNQ-master' into master
Browse files Browse the repository at this point in the history
See #94
  • Loading branch information
timvisee committed Jul 4, 2022
2 parents 0ac1eee + 1a0ddf9 commit 0008541
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions server/middleware/auth.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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();
}
}
};

0 comments on commit 0008541

Please sign in to comment.