nodebb-plugin-session-sharing 7.1.0 → 7.1.2

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
@@ -587,7 +587,7 @@ plugin.appendTemplate = async (data) => {
587
587
  };
588
588
 
589
589
  plugin.saveReverseToken = async ({ req, userData: data }) => {
590
- if (!plugin.ready || plugin.settings.reverseToken !== 'on') {
590
+ if (!plugin.ready || !data || plugin.settings.reverseToken !== 'on') {
591
591
  return; // no reverse token if secret not set
592
592
  }
593
593
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-session-sharing",
3
- "version": "7.1.0",
3
+ "version": "7.1.2",
4
4
  "description": "Allows login sessions from your app to persist in NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -2,22 +2,14 @@
2
2
 
3
3
  /* globals define, $, socket, config */
4
4
 
5
- define('admin/plugins/session-sharing', ['settings', 'alerts'], function (Settings, alerts) {
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'), function () {
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
- <button id="save" class="floating-button mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
294
- <i class="material-icons">save</i>
295
- </button>
289
+ <!-- IMPORT admin/partials/save_button.tpl -->
290
+