v1
宇天 2020-09-18 18:29:07 +08:00
parent 11a435bd83
commit d55907d2c7
2 changed files with 9 additions and 4 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@
._*
.idea
.vscode
node_modules/

View File

@ -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'))