Fixed authentication issues
This commit is contained in:
@ -30,7 +30,7 @@ export default function auth({ require = true } = {}) {
|
|||||||
throw httpErrors.Unauthorized('Authentication required');
|
throw httpErrors.Unauthorized('Authentication required');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token && require) {
|
if (token) {
|
||||||
// Get user without verifying payload signature
|
// Get user without verifying payload signature
|
||||||
let payload;
|
let payload;
|
||||||
try {
|
try {
|
||||||
|
@ -25,7 +25,7 @@ router.post('documents.info', auth({ require: false }), async (ctx) => {
|
|||||||
|
|
||||||
const team = await ctx.state.user.getTeam();
|
const team = await ctx.state.user.getTeam();
|
||||||
if (document.teamId !== team.id) {
|
if (document.teamId !== team.id) {
|
||||||
if (!document) throw httpErrors.NotFound();
|
throw httpErrors.NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
|
Reference in New Issue
Block a user