nodebb-plugin-session-sharing 5.1.9 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/library.js +6 -4
  2. package/package.json +2 -2
package/library.js CHANGED
@@ -3,7 +3,10 @@
3
3
  const winston = module.parent.require('winston');
4
4
  const nconf = module.parent.require('nconf');
5
5
 
6
+ const util = require('util');
7
+
6
8
  const _ = require('lodash');
9
+ const jwt = require('jsonwebtoken');
7
10
 
8
11
  const meta = require.main.require('./src/meta');
9
12
  const user = require.main.require('./src/user');
@@ -12,10 +15,9 @@ const SocketPlugins = require.main.require('./src/socket.io/plugins');
12
15
  const db = require.main.require('./src/database');
13
16
  const plugins = require.main.require('./src/plugins');
14
17
 
15
- const jwt = require('jsonwebtoken');
16
-
17
18
  const controllers = require('./lib/controllers');
18
19
  const nbbAuthController = require.main.require('./src/controllers/authentication');
20
+ const logoutAsync = util.promisify((req, callback) => req.logout(callback));
19
21
 
20
22
  /* all the user profile fields that can be passed to user.updateProfile */
21
23
  const profileFields = [
@@ -407,7 +409,7 @@ plugin.addMiddleware = async function ({ req, res }) {
407
409
  await meta.blacklist.test(req.ip);
408
410
  } catch (error) {
409
411
  if (hasSession) {
410
- req.logout();
412
+ await logoutAsync(req);
411
413
  res.locals.fullRefresh = true;
412
414
  }
413
415
 
@@ -465,7 +467,7 @@ plugin.addMiddleware = async function ({ req, res }) {
465
467
  const isAdmin = await user.isAdministrator(req.user.uid);
466
468
 
467
469
  if (plugin.settings.behaviour !== 'update' && (plugin.settings.adminRevalidate === 'on' || !isAdmin)) {
468
- req.logout();
470
+ await logoutAsync(req);
469
471
  res.locals.fullRefresh = true;
470
472
  return handleGuest(req, res);
471
473
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-session-sharing",
3
- "version": "5.1.9",
3
+ "version": "6.0.0",
4
4
  "description": "Allows login sessions from your app to persist in NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "readmeFilename": "README.md",
23
23
  "nbbpm": {
24
- "compatibility": "^1.17.2 || ^2.0.0"
24
+ "compatibility": "^2.5.0"
25
25
  },
26
26
  "husky": {
27
27
  "hooks": {