Skip to content

Commit

Permalink
Merge pull request #353 from opencollective/unauthenticated-csv-error…
Browse files Browse the repository at this point in the history
…-output

Send proper error when getting members CSV without authentication
  • Loading branch information
znarf authored May 2, 2018
2 parents a5707d7 + a90f210 commit 82b90ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/controllers/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { days } from '../../lib/utils';

const graphqlServerUrl = `${process.env.API_URL}/graphql?api_key=${process.env.API_KEY}`;

export async function list(req, res, next) {
export async function list(req, res) {

const {
collectiveSlug,
Expand Down Expand Up @@ -34,7 +34,7 @@ export async function list(req, res, next) {
headers.authorization = req.headers.authorization;
} else {
if (req.params.format === 'csv') {
return next(new Error("Need to be logged in to export members in CSV"));
return res.status(401).send('Need to be authenticated to export members in CSV');
}
res.setHeader('cache-control','max-age=6000');
}
Expand Down

0 comments on commit 82b90ca

Please sign in to comment.