mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Remove inbox from more routes (#10300)
* remove inbox from user/stats routes * remove inbox from news routes * change signature for authWithHeaders * do not load inbox in coupons routes * do not load inbox in challenge routes * do not load inbox in some members routes * do not load inbox in chat routes
This commit is contained in:
@@ -34,10 +34,11 @@ function getUserFields (userFieldsToExclude, req) {
|
||||
|
||||
// Authenticate a request through the x-api-user and x-api key header
|
||||
// If optional is true, don't error on missing authentication
|
||||
export function authWithHeaders (optional = false, options = {}) {
|
||||
export function authWithHeaders (options = {}) {
|
||||
return function authWithHeadersHandler (req, res, next) {
|
||||
let userId = req.header('x-api-user');
|
||||
let apiToken = req.header('x-api-key');
|
||||
const userId = req.header('x-api-user');
|
||||
const apiToken = req.header('x-api-key');
|
||||
const optional = options.optional || false;
|
||||
|
||||
if (!userId || !apiToken) {
|
||||
if (optional) return next();
|
||||
|
||||
Reference in New Issue
Block a user