From d55907d2c7ed1dc0c5ba557a07283a6a21d7479c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Fri, 18 Sep 2020 18:29:07 +0800 Subject: [PATCH] update --- .gitignore | 3 +++ index.js | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7c24ca8..351c0c3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ ._* .idea .vscode + + +node_modules/ \ No newline at end of file diff --git a/index.js b/index.js index 031f5b8..0ac04fa 100644 --- a/index.js +++ b/index.js @@ -6,8 +6,7 @@ */ import Smarty from 'smartyx' //模板引擎 - -import { sign, verify } from '../module/jwt.js' +import jwt from '@gm5/jwt' const smarty = new Smarty() @@ -18,9 +17,12 @@ export default class Controller { this.request = req this.response = res + jwt.expires = ctx.get('session').ttl + jwt.secret = ctx.get('jwt') + this.jwt = { - sign: sign.bind(this), - result: verify.call(this) + sign: jwt.sign, + result: jwt.verify(req.header('authorized')) } smarty.config('path', this.ctx.get('VIEWS'))