Updated share token logic. Closes #1113.

This commit is contained in:
Mike Cao 2022-05-05 19:04:28 -07:00
parent b5de6b997e
commit e735a1c50d
12 changed files with 44 additions and 42 deletions

View file

@ -1,5 +1,5 @@
import { parseSecureToken, parseToken } from './crypto';
import { TOKEN_HEADER } from './constants';
import { SHARE_TOKEN_HEADER } from './constants';
import { getWebsiteById } from './queries';
export async function getAuthToken(req) {
@ -30,7 +30,7 @@ export async function isValidToken(token, validation) {
export async function allowQuery(req, skipToken) {
const { id } = req.query;
const token = req.headers[TOKEN_HEADER];
const token = req.headers[SHARE_TOKEN_HEADER];
const websiteId = +id;
const website = await getWebsiteById(websiteId);