File tree Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -51,25 +51,23 @@ module.exports = async function checkAuth(ctx, next) {
51
51
Authorization : `token ${ access_token } ` ,
52
52
} ,
53
53
} ) . then ( ( res ) => res . json ( ) ) ;
54
-
54
+ ctx . cookies . set (
55
+ "token" ,
56
+ encrypt (
57
+ Buffer . from (
58
+ JSON . stringify ( {
59
+ ...user ,
60
+ pay : true ,
61
+ } ) ,
62
+ "utf8"
63
+ )
64
+ ) ,
65
+ {
66
+ httpOnly : false ,
67
+ expires : new Date ( 24 * 60 * 60 * 1000 + Date . now ( ) ) ,
68
+ }
69
+ ) ;
55
70
if ( db . find ( ( q ) => q . login === user . login ) ) {
56
- ctx . cookies . set (
57
- "token" ,
58
- encrypt (
59
- Buffer . from (
60
- JSON . stringify ( {
61
- ...user ,
62
- pay : true ,
63
- } ) ,
64
- "utf8"
65
- )
66
- ) ,
67
- {
68
- httpOnly : false ,
69
- expires : new Date ( 24 * 60 * 60 * 1000 + Date . now ( ) ) ,
70
- }
71
- ) ;
72
-
73
71
ctx . session . user = {
74
72
...user ,
75
73
pay : true ,
You can’t perform that action at this time.
0 commit comments