update
parent
11a435bd83
commit
d55907d2c7
|
@ -7,3 +7,6 @@
|
||||||
._*
|
._*
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
|
|
||||||
|
node_modules/
|
10
index.js
10
index.js
|
@ -6,8 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Smarty from 'smartyx' //模板引擎
|
import Smarty from 'smartyx' //模板引擎
|
||||||
|
import jwt from '@gm5/jwt'
|
||||||
import { sign, verify } from '../module/jwt.js'
|
|
||||||
|
|
||||||
const smarty = new Smarty()
|
const smarty = new Smarty()
|
||||||
|
|
||||||
|
@ -18,9 +17,12 @@ export default class Controller {
|
||||||
this.request = req
|
this.request = req
|
||||||
this.response = res
|
this.response = res
|
||||||
|
|
||||||
|
jwt.expires = ctx.get('session').ttl
|
||||||
|
jwt.secret = ctx.get('jwt')
|
||||||
|
|
||||||
this.jwt = {
|
this.jwt = {
|
||||||
sign: sign.bind(this),
|
sign: jwt.sign,
|
||||||
result: verify.call(this)
|
result: jwt.verify(req.header('authorized'))
|
||||||
}
|
}
|
||||||
|
|
||||||
smarty.config('path', this.ctx.get('VIEWS'))
|
smarty.config('path', this.ctx.get('VIEWS'))
|
||||||
|
|
Loading…
Reference in New Issue