Don't generate jwt token for guest

Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
This commit is contained in:
Yukai Huang 2020-03-09 21:41:21 +08:00
parent c8462c72b3
commit 6bffadaf38
No known key found for this signature in database
GPG Key ID: A76CBD50B22052C0
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ function actionPDF (req, res, note) {
const noteId = req.params.noteId
if (req.method === 'POST') {
const token = jwt.sign({ userId: req.user.id.toString() }, config.codimdSignKey, { expiresIn: 5 * 60 })
const token = req.user && jwt.sign({ userId: req.user.id.toString() }, config.codimdSignKey, { expiresIn: 5 * 60 })
const noteURL = `${config.serverURL}/${noteId}/pdf`