nodebb-plugin-session-sharing 6.0.0 → 7.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-session-sharing",
3
- "version": "6.0.0",
3
+ "version": "7.0.1",
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": "^2.5.0"
24
+ "compatibility": "^3.0.0"
25
25
  },
26
26
  "husky": {
27
27
  "hooks": {
package/plugin.json CHANGED
@@ -12,9 +12,6 @@
12
12
  { "hook": "action:settings.set", "method": "reloadSettings" },
13
13
  { "hook": "action:login.continue", "method": "saveReverseToken" }
14
14
  ],
15
- "less": [
16
- "static/style.less"
17
- ],
18
15
  "scripts": [
19
16
  "static/lib/main.js"
20
17
  ],
@@ -2,225 +2,224 @@
2
2
  <div class="row">
3
3
  <div class="col-md-9">
4
4
  <div class="row">
5
- <div class="col-sm-2 col-xs-12 settings-header">General</div>
6
- <div class="col-sm-10 col-xs-12">
7
- <div class="form-group">
8
- <label for="name">Base Name</label>
5
+ <div class="col-sm-2 col-12 settings-header">General</div>
6
+ <div class="col-sm-10 col-12">
7
+ <div class="mb-3">
8
+ <label class="form-label" for="name">Base Name</label>
9
9
  <input type="text" id="name" name="name" title="Base Name" class="form-control" placeholder="appId" />
10
10
  </div>
11
- <div class="form-group">
12
- <label for="cookieName">Cookie Name</label>
11
+ <div class="mb-3">
12
+ <label class="form-label" for="cookieName">Cookie Name</label>
13
13
  <input type="text" id="cookieName" name="cookieName" title="Cookie Name" class="form-control" placeholder="token" />
14
14
  </div>
15
- <div class="form-group">
16
- <label for="cookieDomain">Cookie Domain</label>
15
+ <div class="mb-3">
16
+ <label class="form-label" for="cookieDomain">Cookie Domain</label>
17
17
  <input type="text" id="cookieDomain" name="cookieDomain" title="Cookie Domain" class="form-control" />
18
- <p class="help-block">
18
+ <p class="form-text">
19
19
  Specifying the common cookie domain here will allow NodeBB to delete the common cookie when a user
20
20
  logs out of NodeBB. If not set (default), then the user will simply be logged in again as their
21
21
  common cookie still exists. This may actually be what you want.
22
22
  </p>
23
23
  </div>
24
- <div class="form-group">
25
- <label for="secret">JWT Secret</label>
24
+ <div class="mb-3">
25
+ <label class="form-label" for="secret">JWT Secret</label>
26
26
  <input type="text" id="secret" name="secret" title="JWT Secret" class="form-control" />
27
- <p class="help-block">
27
+ <p class="form-text">
28
28
  This value is the secret key you used to encode your JSON Web Token. NodeBB needs the same secret
29
29
  otherwise the JWT cannot be properly decoded.
30
30
  </p>
31
31
  </div>
32
- <div class="form-group">
33
- <label for="hostWhitelist">Host Whitelist</label>
32
+ <div class="mb-3">
33
+ <label class="form-label" for="hostWhitelist">Host Whitelist</label>
34
34
  <input type="text" id="hostWhitelist" name="hostWhitelist" title="Host Whitelist" class="form-control" placeholder="localhost" />
35
- <p class="help-block">
35
+ <p class="form-text">
36
36
  If set, session-sharing plugin works only on whitelisted domains. Separate with commas, for example: "localhost,test.domain.com".
37
37
  </p>
38
38
  </div>
39
39
  </div>
40
40
  </div>
41
41
  <div class="row">
42
- <div class="col-sm-2 col-xs-12 settings-header">Session Handling</div>
43
- <div class="col-sm-10 col-xs-12">
44
- <div class="form-group">
45
- <label for="behaviour">Cookie changes</label>
42
+ <div class="col-sm-2 col-12 settings-header">Session Handling</div>
43
+ <div class="col-sm-10 col-12">
44
+ <div class="mb-3">
45
+ <label class="form-label" for="behaviour">Cookie changes</label>
46
46
  <select class="form-control" name="behaviour" id="behaviour">
47
47
  <option value="trust">"Trust" &rarr; Shared cookie token used once only to authenticate, session persists even if cookie cleared</option>
48
48
  <option value="revalidate">"Revalidate" &rarr; Shared cookie is checked on every page load, and updated/logged out to reflect changes in cookie</option>
49
49
  <option value="update">"Update" &rarr; Shared cookie is checked on every page load, and updated to reflect changes in cookie. But user is not logged out when cookie is missing</option>
50
50
  </select>
51
51
  </div>
52
- <div class="checkbox">
53
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
54
- <input class="mdl-switch__input" type="checkbox" id="adminRevalidate" name="adminRevalidate" />
55
- <span class="mdl-switch__label"><strong>Apply revalidation rules to administrators as well</strong></span>
56
- </label>
57
- <p class="help-block">
58
- Administrators are exempt from the <code>revalidate</code> behaviour because a
59
- misconfiguration could lock them out of the admin panel. Enable this option to force
60
- administrators to also undergo cookie revalidation, and thereby increasing security.
61
- </p>
62
- <p class="help-block">
63
- This option is disabled by default to allow for smoother setup.
64
- </p>
65
- </div>
66
- <div class="checkbox">
67
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
68
- <input class="mdl-switch__input" type="checkbox" id="noRegistration" name="noRegistration" />
69
- <span class="mdl-switch__label"><strong>Do not automatically create NodeBB accounts for unrecognized users</strong></span>
52
+
53
+ <div class="form-check">
54
+ <input class="form-check-input" type="checkbox" id="adminRevalidate" name="adminRevalidate" />
55
+ <label class="form-check-label">
56
+ <span><strong>Apply revalidation rules to administrators as well</strong></span>
70
57
  </label>
71
- <p class="help-block">
58
+ <p class="form-text">
59
+ Administrators are exempt from the <code>revalidate</code> behaviour because a
60
+ misconfiguration could lock them out of the admin panel. Enable this option to force
61
+ administrators to also undergo cookie revalidation, and thereby increasing security.
62
+ </p>
63
+ <p class="form-text">
64
+ This option is disabled by default to allow for smoother setup.
65
+ </p>
66
+ </div>
67
+ <div class="form-check">
68
+ <input class="form-check-input" type="checkbox" id="noRegistration" name="noRegistration" />
69
+ <label class="form-check-label">
70
+ <span><strong>Do not automatically create NodeBB accounts for unrecognized users</strong></span>
71
+ </label>
72
+ <p class="form-text">
72
73
  By default, an unrecognized user id found in a payload cookie will have a local NodeBB account automatically created for it. If enabled,
73
74
  that cookie will not resolve into a session and that client will remain a guest.
74
75
  </p>
75
76
  </div>
76
- <div class="checkbox">
77
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
78
- <input class="mdl-switch__input" type="checkbox" id="updateProfile" name="updateProfile" />
79
- <span class="mdl-switch__label"><strong>Automatically update local profile information with information found in shared cookie</strong></span>
77
+ <div class="form-check">
78
+ <input class="form-check-input" type="checkbox" id="updateProfile" name="updateProfile" />
79
+ <label class="form-check-label">
80
+ <span><strong>Automatically update local profile information with information found in shared cookie</strong></span>
80
81
  </label>
81
- <div class="help-block">
82
+ <div class="form-text">
82
83
  Basic information such as username and id are required, while others are optional (first name, last name, etc.). Enable this setting to allow
83
84
  NodeBB to automatically sync up the local profile with the information provided.
84
85
  </div>
85
86
  </div>
86
- <div class="checkbox">
87
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
88
- <input class="mdl-switch__input" type="checkbox" id="allowBannedUsers" name="allowBannedUsers" />
89
- <span class="mdl-switch__label"><strong>Allow banned users to be logged in and placed into banned user group</strong></span>
87
+ <div class="form-check">
88
+ <input class="form-check-input" type="checkbox" id="allowBannedUsers" name="allowBannedUsers" />
89
+ <label class="form-check-label">
90
+ <span><strong>Allow banned users to be logged in and placed into banned user group</strong></span>
90
91
  </label>
91
- <p class="help-block">
92
+ <p class="form-text">
92
93
  By default banned users arent logged in and an error is thrown. If enabled, banned users are logged in and placed in the banned group.
93
94
  </p>
94
95
  </div>
95
- <div class="checkbox">
96
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
97
- <input class="mdl-switch__input" type="checkbox" id="syncGroupJoin" name="syncGroupJoin" />
98
- <span class="mdl-switch__label"><strong>Automatically join groups if present in payload</strong></span>
96
+ <div class="form-check">
97
+ <input class="form-check-input" type="checkbox" id="syncGroupJoin" name="syncGroupJoin" />
98
+ <label class="form-check-label">
99
+ <span><strong>Automatically join groups if present in payload</strong></span>
99
100
  </label>
100
101
  </div>
101
- <div class="checkbox">
102
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
103
- <input class="mdl-switch__input" type="checkbox" id="syncGroupLeave" name="syncGroupLeave" />
104
- <span class="mdl-switch__label"><strong>Automatically leave groups if not present in payload</strong></span>
102
+ <div class="form-check">
103
+ <input class="form-check-input" type="checkbox" id="syncGroupLeave" name="syncGroupLeave" />
104
+ <label class="form-check-label">
105
+ <span><strong>Automatically leave groups if not present in payload</strong></span>
105
106
  </label>
106
107
  </div>
107
- <div class="checkbox">
108
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
109
- <input class="mdl-switch__input" type="checkbox" id="syncGroupList" name="syncGroupList" />
110
- <span class="mdl-switch__label"><strong>Select groups to join/leave</strong></span>
108
+ <div class="form-check">
109
+ <input class="form-check-input" type="checkbox" id="syncGroupList" name="syncGroupList" />
110
+ <label class="form-check-label">
111
+ <span><strong>Select groups to join/leave</strong></span>
111
112
  </label>
112
113
  </div>
113
- <div class="form-group">
114
- <select class="form-control" id="syncGroups" name="syncGroups" multiple size="10">
115
- <!-- BEGIN groups -->
116
- <option value="{groups.displayName}">{groups.displayName}</option>
117
- <!-- END groups -->
118
- </select>
119
- </div>
120
- <div class="form-group">
121
- <label for="logoutRedirect">Logout Redirection</label>
114
+ <select class="form-select mb-3" id="syncGroups" name="syncGroups" multiple size="10">
115
+ <!-- BEGIN groups -->
116
+ <option value="{groups.displayName}">{groups.displayName}</option>
117
+ <!-- END groups -->
118
+ </select>
119
+ <div class="mb-3">
120
+ <label class="form-label" for="logoutRedirect">Logout Redirection</label>
122
121
  <input type="text" class="form-control" id="logoutRedirect" name="logoutRedirect" />
123
- <p class="help-block">
122
+ <p class="form-text">
124
123
  If set, once a user logs out from NodeBB, they will be sent to this link. Setting this option may be useful if you'd like to trigger
125
124
  a session logout in your own application instead.
126
125
  </p>
127
126
  </div>
128
- <div class="form-group">
129
- <label for="loginOverride">Login Override</label>
127
+ <div class="mb-3">
128
+ <label class="form-label" for="loginOverride">Login Override</label>
130
129
  <input type="text" class="form-control" id="loginOverride" name="loginOverride" />
131
- <p class="help-block">
130
+ <p class="form-text">
132
131
  If set, users clicking the "Login" button will be redirected to this link instead
133
132
  </p>
134
133
  </div>
135
- <div class="form-group">
136
- <label for="registerOverride">Register Override</label>
134
+ <div class="mb-3">
135
+ <label class="form-label" for="registerOverride">Register Override</label>
137
136
  <input type="text" class="form-control" id="registerOverride" name="registerOverride" />
138
- <p class="help-block">
137
+ <p class="form-text">
139
138
  If set, users clicking the "Register" button will be redirected to this link instead
140
139
  </p>
141
140
  </div>
142
- <div class="form-group">
143
- <label for="editOverride">Edit Profile Override</label>
141
+ <div class="mb-3">
142
+ <label class="form-label" for="editOverride">Edit Profile Override</label>
144
143
  <input type="text" class="form-control" id="editOverride" name="editOverride" />
145
- <p class="help-block">
144
+ <p class="form-text">
146
145
  If set, users clicking the "Edit Profile" button will be redirected to this link instead
147
146
  </p>
148
147
  </div>
149
148
  </div>
150
149
  </div>
151
150
  <div class="row">
152
- <div class="col-sm-2 col-xs-12 settings-header">Payload Keys</div>
153
- <div class="col-sm-10 col-xs-12">
151
+ <div class="col-sm-2 col-12 settings-header">Payload Keys</div>
152
+ <div class="col-sm-10 col-12">
154
153
  <p>
155
154
  In general, you should not need to change these values, as you should be adjusting your app's cookie's
156
155
  JWT payload keys to match the defaults. However if circumstances require you to have different values,
157
156
  you can change them here.
158
157
  </p>
159
- <p class="help-block">
158
+ <p class="form-text">
160
159
  Default values are shown as placeholders in the corresponding input fields.
161
160
  </p>
162
- <div class="form-group">
163
- <label for="name">Unique ID</label>
161
+ <div class="mb-3">
162
+ <label class="form-label" for="name">Unique ID</label>
164
163
  <input type="text" id="payload:id" name="payload:id" title="Unique ID" class="form-control" placeholder="id">
165
164
  </div>
166
- <div class="form-group">
167
- <label for="payload:email">Email</label>
165
+ <div class="mb-3">
166
+ <label class="form-label" for="payload:email">Email</label>
168
167
  <input type="text" id="payload:email" name="payload:email" title="Email" class="form-control" placeholder="email">
169
168
  </div>
170
- <div class="form-group">
171
- <label for="payload:username">Username</label>
169
+ <div class="mb-3">
170
+ <label class="form-label" for="payload:username">Username</label>
172
171
  <input type="text" id="payload:username" name="payload:username" title="Username" class="form-control" placeholder="username">
173
- <p class="help-block">
172
+ <p class="form-text">
174
173
  The plugin will try to generate this value from the fullname, if no username is given.
175
174
  </p>
176
175
  </div>
177
- <div class="form-group">
178
- <label for="payload:fullname">Full name</label>
176
+ <div class="mb-3">
177
+ <label class="form-label" for="payload:fullname">Full name</label>
179
178
  <input type="text" id="payload:fullname" name="payload:fullname" title="Full name" class="form-control" placeholder="fullname">
180
- <p class="help-block">
179
+ <p class="form-text">
181
180
  The plugin will use a combination of first name and last name, if no fullname is given. If given, the following two fields will be ignored.
182
181
  </p>
183
182
  </div>
184
- <div class="form-group">
185
- <label for="payload:firstName">First Name (deprecated)</label>
183
+ <div class="mb-3">
184
+ <label class="form-label" for="payload:firstName">First Name (deprecated)</label>
186
185
  <input type="text" id="payload:firstName" name="payload:firstName" title="First Name (deprecated)" class="form-control" placeholder="firstName">
187
186
  </div>
188
- <div class="form-group">
189
- <label for="payload:lastName">Last Name (deprecated)</label>
187
+ <div class="mb-3">
188
+ <label class="form-label" for="payload:lastName">Last Name (deprecated)</label>
190
189
  <input type="text" id="payload:lastName" name="payload:lastName" title="Last Name (deprecated)" class="form-control" placeholder="lastName">
191
190
  </div>
192
- <div class="form-group">
193
- <label for="payload:website">Website</label>
191
+ <div class="mb-3">
192
+ <label class="form-label" for="payload:website">Website</label>
194
193
  <input type="text" id="payload:website" name="payload:website" title="Website" class="form-control" placeholder="website">
195
194
  </div>
196
- <div class="form-group">
197
- <label for="payload:birthday">Birthday</label>
195
+ <div class="mb-3">
196
+ <label class="form-label" for="payload:birthday">Birthday</label>
198
197
  <input type="text" id="payload:birthday" name="payload:birthday" title="Birthday" class="form-control" placeholder="birthday">
199
198
  </div>
200
- <div class="form-group">
201
- <label for="payload:aboutme">About</label>
199
+ <div class="mb-3">
200
+ <label class="form-label" for="payload:aboutme">About</label>
202
201
  <input type="text" id="payload:aboutme" name="payload:aboutme" title="About" class="form-control" placeholder="aboutme">
203
202
  </div>
204
- <div class="form-group">
205
- <label for="payload:location">Location</label>
203
+ <div class="mb-3">
204
+ <label class="form-label" for="payload:location">Location</label>
206
205
  <input type="text" id="payload:location" name="payload:location" title="Location" class="form-control" placeholder="location">
207
206
  </div>
208
- <div class="form-group">
209
- <label for="payload:signature">Signature</label>
207
+ <div class="mb-3">
208
+ <label class="form-label" for="payload:signature">Signature</label>
210
209
  <input type="text" id="payload:signature" name="payload:signature" title="Signature" class="form-control" placeholder="signature">
211
210
  </div>
212
- <div class="form-group">
213
- <label for="payload:signature">Group Title</label>
211
+ <div class="mb-3">
212
+ <label class="form-label" for="payload:signature">Group Title</label>
214
213
  <input type="text" id="payload:groupTitle" name="payload:groupTitle" title="Signature" class="form-control" placeholder="groupTitle">
215
214
  </div>
216
- <div class="form-group">
217
- <label for="payload:picture">Picture</label>
215
+ <div class="mb-3">
216
+ <label class="form-label" for="payload:picture">Picture</label>
218
217
  <input type="text" id="payload:picture" name="payload:picture" title="Picture" class="form-control" placeholder="picture">
219
218
  </div>
220
- <div class="form-group">
221
- <label for="payloadParent">Parent Key</label>
219
+ <div class="mb-3">
220
+ <label class="form-label" for="payloadParent">Parent Key</label>
222
221
  <input type="text" id="payloadParent" name="payloadParent" title="Parent Key" class="form-control">
223
- <p class="help-block">
222
+ <p class="form-text">
224
223
  If your user data is contained in a subkey inside of the payload data, specify its key here.
225
224
  Otherwise, this plugin assumes the relevant data is at the root level.
226
225
  </p>
@@ -228,34 +227,34 @@
228
227
  </div>
229
228
  </div>
230
229
  <div class="row">
231
- <div class="col-sm-2 col-xs-12 settings-header">Guest Handling</div>
232
- <div class="col-sm-10 col-xs-12">
233
- <div class="form-group">
234
- <label for="guestRedirect">Re-direct unauthenticated sessions (guests) to this address</label>
230
+ <div class="col-sm-2 col-12 settings-header">Guest Handling</div>
231
+ <div class="col-sm-10 col-12">
232
+ <div class="mb-3">
233
+ <label class="form-label" for="guestRedirect">Re-direct unauthenticated sessions (guests) to this address</label>
235
234
  <input type="text" id="guestRedirect" name="guestRedirect" class="form-control" placeholder="https://...">
236
- <p class="help-block">
235
+ <p class="form-text">
237
236
  Blank value disables guest redirection.
238
237
  </p>
239
- <p class="help-block">
238
+ <p class="form-text">
240
239
  <code>%1</code> can be used as a placeholder for the link the user landed on (will be URL encoded)
241
240
  </p>
242
241
  </div>
243
242
  </div>
244
243
  </div>
245
244
  <div class="row">
246
- <div class="col-sm-2 col-xs-12 settings-header">Reverse Token</div>
247
- <div class="col-sm-10 col-xs-12">
248
- <div class="form-group">
249
- <div class="checkbox">
250
- <label for="reverseToken" class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
251
- <input type="checkbox" class="mdl-switch__input" id="reverseToken" name="reverseToken">
252
- <span class="mdl-switch__label"><strong>Enabled</strong></span>
245
+ <div class="col-sm-2 col-12 settings-header">Reverse Token</div>
246
+ <div class="col-sm-10 col-12">
247
+ <div class="mb-3">
248
+ <div class="form-check">
249
+ <input type="checkbox" class="form-check-input" id="reverseToken" name="reverseToken">
250
+ <label class="form-label" for="reverseToken" class="form-check-label">
251
+ <span><strong>Enabled</strong></span>
253
252
  </label>
254
253
  </div>
255
- <p class="help-block">
254
+ <p class="form-text">
256
255
  If enabled, NodeBB will save a cookie called <code>nbb_token</code> that can be read by other sites on the same domain. It will allow other sites to authenticate a user session based on NodeBB login state.
257
256
  </p>
258
- <p class="help-block">
257
+ <p class="form-text">
259
258
  Similar to what is accepted by the session-sharing plugin, the reverse token is a signed <a href="//jwt.io">JWT</a> containing the logged in user's username and uid. Guests will not have an `nbb_token`.
260
259
  </p>
261
260
  </div>
@@ -263,25 +262,25 @@
263
262
  </div>
264
263
  </div>
265
264
  <div class="col-md-3">
266
- <div class="panel panel-default">
267
- <div class="panel-heading">
268
- <h3 class="panel-title">User Search</h3>
265
+ <div class="card">
266
+ <div class="card-header">
267
+ <span class="fs-4">User Search</span>
269
268
  </div>
270
- <div class="panel-body">
269
+ <div class="card-body">
271
270
  <input type="text" class="form-control" id="search" />
272
- <p class="help-block">
271
+ <p class="form-text">
273
272
  Search for a username here to find their associated unique ID.
274
273
  </p>
275
274
  <p id="result"></p>
276
275
  </div>
277
276
  </div>
278
- <div class="panel panel-default">
279
- <div class="panel-heading">
280
- <h3 class="panel-title">Remote ID Search</h3>
277
+ <div class="card">
278
+ <div class="card-header">
279
+ <span class="fs-4">Remote ID Search</span>
281
280
  </div>
282
- <div class="panel-body">
281
+ <div class="card-body">
283
282
  <input type="text" class="form-control" id="remote_search" />
284
- <p class="help-block">
283
+ <p class="form-text">
285
284
  Enter a remote ID here to find their NodeBB user profile.
286
285
  </p>
287
286
  <p id="local_result"></p>
package/static/style.less DELETED
@@ -1 +0,0 @@
1
- /* Place any LESS in here */