|
@@ -104,22 +104,22 @@ app.use(cookieSession({ |
|
@@ -104,22 +104,22 @@ app.use(cookieSession({ |
104
|
}));
|
104
|
}));
|
105
|
|
105
|
|
106
|
app.use((req, res, next) => {
|
106
|
app.use((req, res, next) => {
|
107
|
- // if (req.session) {
|
|
|
108
|
- // let sessionKeys = Object.keys(req.session || {});
|
|
|
109
|
- // let backSessionKeys = Object.keys(req.session2.sessionBack || {});
|
|
|
110
|
-
|
|
|
111
|
- // if (backSessionKeys.length > sessionKeys.length) {
|
|
|
112
|
- // let differences = _.difference(backSessionKeys, sessionKeys);
|
|
|
113
|
-
|
|
|
114
|
- // _.forEach(differences, d => {
|
|
|
115
|
- // req.session[d] = req.session2.sessionBack[d];
|
|
|
116
|
- // });
|
|
|
117
|
- // }
|
|
|
118
|
- // req.session2.sessionBack = req.session;
|
|
|
119
|
- // } else {
|
|
|
120
|
- // req.session = new memcachedSession.Session(req);
|
|
|
121
|
- // req.session = _.assign(req.session, req.session2.sessionBack);
|
|
|
122
|
- // }
|
107
|
+ if (req.session) {
|
|
|
108
|
+ let sessionKeys = Object.keys(req.session || {});
|
|
|
109
|
+ let backSessionKeys = Object.keys(req.session2.sessionBack || {});
|
|
|
110
|
+
|
|
|
111
|
+ if (backSessionKeys.length > sessionKeys.length) {
|
|
|
112
|
+ let differences = _.difference(backSessionKeys, sessionKeys);
|
|
|
113
|
+
|
|
|
114
|
+ _.forEach(differences, d => {
|
|
|
115
|
+ req.session[d] = req.session2.sessionBack[d];
|
|
|
116
|
+ });
|
|
|
117
|
+ }
|
|
|
118
|
+ req.session2.sessionBack = req.session;
|
|
|
119
|
+ } else {
|
|
|
120
|
+ req.session = new memcachedSession.Session(req);
|
|
|
121
|
+ req.session = _.assign(req.session, req.session2.sessionBack);
|
|
|
122
|
+ }
|
123
|
|
123
|
|
124
|
if (!req.sessionID) {
|
124
|
if (!req.sessionID) {
|
125
|
req.sessionID = uuid.v4();
|
125
|
req.sessionID = uuid.v4();
|