nodebb-plugin-session-sharing 5.1.0 → 5.1.4

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.
@@ -1,3 +1,26 @@
1
1
  'use strict';
2
2
 
3
- module.exports = { extends: ['@commitlint/config-angular'] };
3
+ module.exports = {
4
+ extends: ['@commitlint/config-angular'],
5
+ rules: {
6
+ 'header-max-length': [1, 'always', 72],
7
+ 'type-enum': [
8
+ 2,
9
+ 'always',
10
+ [
11
+ 'breaking',
12
+ 'build',
13
+ 'chore',
14
+ 'ci',
15
+ 'docs',
16
+ 'feat',
17
+ 'fix',
18
+ 'perf',
19
+ 'refactor',
20
+ 'revert',
21
+ 'style',
22
+ 'test',
23
+ ],
24
+ ],
25
+ },
26
+ };
package/library.js CHANGED
@@ -392,7 +392,7 @@ plugin.addMiddleware = async function ({ req, res }) {
392
392
  return;
393
393
  }
394
394
 
395
- if (editOverride && hasSession && req.originalUrl.match(/\/user\/.*\/edit$/)) {
395
+ if (editOverride && hasSession && req.originalUrl.match(/\/user\/.*\/edit(\/\w+)?$/)) {
396
396
  return res.redirect(editOverride.replace('%1', encodeURIComponent(req.protocol + '://' + req.get('host') + req.originalUrl)));
397
397
  }
398
398
  if (loginOverride && req.originalUrl.match(/\/login$/)) {
@@ -569,7 +569,7 @@ plugin.reloadSettings = async (data) => {
569
569
  };
570
570
 
571
571
  plugin.appendTemplate = async (data) => {
572
- if (!data.req.session.sessionSharing || !data.req.session.sessionSharing.banned) {
572
+ if (!data.req.session || !data.req.session.sessionSharing || !data.req.session.sessionSharing.banned) {
573
573
  return data;
574
574
  }
575
575
 
@@ -591,6 +591,7 @@ plugin.saveReverseToken = async ({ req, userData: data }) => {
591
591
 
592
592
  const res = req.res;
593
593
  const userData = await user.getUserFields(data.uid, ['uid', 'username', 'picture', 'reputation', 'postcount', 'banned']);
594
+ userData.groups = (await groups.getUserGroups([data.uid])).pop();
594
595
  const token = jwt.sign(userData, plugin.settings.secret);
595
596
 
596
597
  res.cookie('nbb_token', token, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-session-sharing",
3
- "version": "5.1.0",
3
+ "version": "5.1.4",
4
4
  "description": "Allows login sessions from your app to persist in NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -20,7 +20,7 @@ $(document).ready(function () {
20
20
  }
21
21
 
22
22
  function isEditUrl(url) {
23
- return url.match(/^user\/.*\/edit$/);
23
+ return url.match(/^user\/.*\/edit(\/\w+)?$/);
24
24
  }
25
25
 
26
26
  $(window).on('action:app.loggedOut', function (evt, data) {