nodebb-plugin-session-sharing 7.0.1 → 7.1.1
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.
package/library.js
CHANGED
|
@@ -420,13 +420,12 @@ plugin.addMiddleware = async function ({ req, res }) {
|
|
|
420
420
|
if (Object.keys(req.cookies).length && req.cookies.hasOwnProperty(plugin.settings.cookieName) && req.cookies[plugin.settings.cookieName].length) {
|
|
421
421
|
try {
|
|
422
422
|
const uid = await plugin.process(req.cookies[plugin.settings.cookieName]);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (plugin.settings.behaviour === 'revalidate' || plugin.settings.behaviour === 'update') {
|
|
427
|
-
res.locals.reroll = false; // disable session rerolling in core
|
|
423
|
+
if (uid === req.uid) {
|
|
424
|
+
winston.verbose(`[session-sharing] Re-validated login for uid ${uid}, path ${req.originalUrl}`);
|
|
425
|
+
return;
|
|
428
426
|
}
|
|
429
427
|
|
|
428
|
+
winston.verbose('[session-sharing] Processing login for uid ' + uid + ', path ' + req.originalUrl);
|
|
430
429
|
await nbbAuthController.doLogin(req, uid);
|
|
431
430
|
|
|
432
431
|
req.session.loginLock = true;
|
|
@@ -467,6 +466,7 @@ plugin.addMiddleware = async function ({ req, res }) {
|
|
|
467
466
|
const isAdmin = await user.isAdministrator(req.user.uid);
|
|
468
467
|
|
|
469
468
|
if (plugin.settings.behaviour !== 'update' && (plugin.settings.adminRevalidate === 'on' || !isAdmin)) {
|
|
469
|
+
winston.verbose(`[session-sharing] Found login session but no cookie, logging out user (was uid ${req.uid})`);
|
|
470
470
|
await logoutAsync(req);
|
|
471
471
|
res.locals.fullRefresh = true;
|
|
472
472
|
return handleGuest(req, res);
|
package/package.json
CHANGED
package/static/lib/admin.js
CHANGED
|
@@ -2,22 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
/* globals define, $, socket, config */
|
|
4
4
|
|
|
5
|
-
define('admin/plugins/session-sharing', ['settings'
|
|
5
|
+
define('admin/plugins/session-sharing', ['settings'], function (Settings) {
|
|
6
6
|
var ACP = {};
|
|
7
7
|
|
|
8
8
|
ACP.init = function () {
|
|
9
9
|
Settings.load('session-sharing', $('.session-sharing-settings'));
|
|
10
10
|
|
|
11
11
|
$('#save').on('click', function () {
|
|
12
|
-
Settings.save('session-sharing', $('.session-sharing-settings')
|
|
13
|
-
alerts.alert({
|
|
14
|
-
type: 'success',
|
|
15
|
-
alert_id: 'session-sharing-saved',
|
|
16
|
-
title: 'Settings Saved',
|
|
17
|
-
message: 'No restart/reload is required',
|
|
18
|
-
timeout: 5000,
|
|
19
|
-
});
|
|
20
|
-
});
|
|
12
|
+
Settings.save('session-sharing', $('.session-sharing-settings'));
|
|
21
13
|
});
|
|
22
14
|
|
|
23
15
|
$('#search').on('keyup', ACP.showUserId);
|
|
@@ -35,14 +27,17 @@ define('admin/plugins/session-sharing', ['settings', 'alerts'], function (Settin
|
|
|
35
27
|
ACP._searchDelay = setTimeout(function () {
|
|
36
28
|
delete ACP._searchDelay;
|
|
37
29
|
|
|
30
|
+
const resultEl = $('#result');
|
|
31
|
+
if (!element.val()) {
|
|
32
|
+
return resultEl.text('');
|
|
33
|
+
}
|
|
34
|
+
|
|
38
35
|
var qs = decodeURIComponent($.param({
|
|
39
36
|
query: element.val(),
|
|
40
37
|
}));
|
|
41
38
|
|
|
42
39
|
$.get(config.relative_path + '/api/admin/manage/users?' + qs)
|
|
43
40
|
.then(function (results) {
|
|
44
|
-
var resultEl = $('#result');
|
|
45
|
-
|
|
46
41
|
if (results.users.length) {
|
|
47
42
|
socket.emit('plugins.sessionSharing.showUserIds', {
|
|
48
43
|
uids: results.users.map(function (user) {
|
|
@@ -79,6 +74,10 @@ define('admin/plugins/session-sharing', ['settings', 'alerts'], function (Settin
|
|
|
79
74
|
ACP._searchDelay = setTimeout(function () {
|
|
80
75
|
delete ACP._searchDelay;
|
|
81
76
|
|
|
77
|
+
if (!element.val()) {
|
|
78
|
+
return $('#local_result').text('');
|
|
79
|
+
}
|
|
80
|
+
|
|
82
81
|
socket.emit('plugins.sessionSharing.findUserByRemoteId', {
|
|
83
82
|
remoteId: element.val(),
|
|
84
83
|
}, function (err, results) {
|
|
@@ -263,10 +263,8 @@
|
|
|
263
263
|
</div>
|
|
264
264
|
<div class="col-md-3">
|
|
265
265
|
<div class="card">
|
|
266
|
-
<div class="card-header">
|
|
267
|
-
<span class="fs-4">User Search</span>
|
|
268
|
-
</div>
|
|
269
266
|
<div class="card-body">
|
|
267
|
+
<h5 class="card-title">User Search</h5>
|
|
270
268
|
<input type="text" class="form-control" id="search" />
|
|
271
269
|
<p class="form-text">
|
|
272
270
|
Search for a username here to find their associated unique ID.
|
|
@@ -275,10 +273,8 @@
|
|
|
275
273
|
</div>
|
|
276
274
|
</div>
|
|
277
275
|
<div class="card">
|
|
278
|
-
<div class="card-header">
|
|
279
|
-
<span class="fs-4">Remote ID Search</span>
|
|
280
|
-
</div>
|
|
281
276
|
<div class="card-body">
|
|
277
|
+
<h5 class="card-title">Remote ID Search</h5>
|
|
282
278
|
<input type="text" class="form-control" id="remote_search" />
|
|
283
279
|
<p class="form-text">
|
|
284
280
|
Enter a remote ID here to find their NodeBB user profile.
|
|
@@ -290,6 +286,5 @@
|
|
|
290
286
|
</div>
|
|
291
287
|
</form>
|
|
292
288
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
</button>
|
|
289
|
+
<!-- IMPORT admin/partials/save_button.tpl -->
|
|
290
|
+
|