nodebb-plugin-sso-facebook 4.0.5 → 4.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
@@ -30,6 +30,7 @@
30
30
 
31
31
  hostHelpers.setupAdminPageRoute(params.router, '/admin/plugins/sso-facebook', function (req, res) {
32
32
  res.render('admin/plugins/sso-facebook', {
33
+ title: constants.name,
33
34
  baseUrl: nconf.get('url'),
34
35
  });
35
36
  });
@@ -205,9 +206,10 @@
205
206
  async.waterfall([
206
207
  // Reset email confirm throttle
207
208
  async.apply(db.delete, 'uid:' + userData.uid + ':confirm:email:sent'),
208
- async.apply(user.getUserField, userData.uid, 'email'),
209
+ function (next) {
210
+ user.getUserField(userData.uid, 'email', next);
211
+ },
209
212
  function (email, next) {
210
- // Remove the old email from sorted set reference
211
213
  db.sortedSetRemove('email:uid', email, next);
212
214
  },
213
215
  async.apply(user.setUserField, userData.uid, 'email', data.email),
@@ -308,24 +310,13 @@
308
310
  callback(null, custom_header);
309
311
  };
310
312
 
311
- Facebook.deleteUserData = function (data, callback) {
312
- var uid = data.uid;
313
-
314
- async.waterfall([
315
- async.apply(user.getUserField, uid, 'fbid'),
316
- function (oAuthIdToDelete, next) {
317
- db.deleteObjectField('fbid:uid', oAuthIdToDelete, next);
318
- },
319
- function (next) {
320
- db.deleteObjectField('user:' + uid, 'fbid', next);
321
- },
322
- ], function (err) {
323
- if (err) {
324
- winston.error('[sso-facebook] Could not remove OAuthId data for uid ' + uid + '. Error: ' + err);
325
- return callback(err);
326
- }
327
- callback(null, uid);
328
- });
313
+ Facebook.deleteUserData = async function (data) {
314
+ const { uid } = data;
315
+ const fbid = await user.getUserField(uid, 'fbid');
316
+ if (fbid) {
317
+ await db.deleteObjectField('fbid:uid', oAuthIdToDelete);
318
+ await db.deleteObjectField('user:' + uid, 'fbid');
319
+ }
329
320
  };
330
321
 
331
322
  module.exports = Facebook;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-sso-facebook",
3
- "version": "4.0.5",
3
+ "version": "4.1.1",
4
4
  "description": "NodeBB Facebook SSO",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -29,6 +29,6 @@
29
29
  "passport-facebook": "~1.0.2"
30
30
  },
31
31
  "nbbpm": {
32
- "compatibility": "^3.0.0"
32
+ "compatibility": "^4.0.0"
33
33
  }
34
34
  }
@@ -1,4 +1,4 @@
1
- define('admin/plugins/sso-facebook', ['settings'], function(Settings) {
1
+ define('admin/plugins/sso-facebook', ['settings', 'alerts'], function(Settings, alerts) {
2
2
  'use strict';
3
3
  /* globals $, app, socket, require */
4
4
 
@@ -9,7 +9,7 @@ define('admin/plugins/sso-facebook', ['settings'], function(Settings) {
9
9
 
10
10
  $('#save').on('click', function() {
11
11
  Settings.save('sso-facebook', $('.sso-facebook-settings'), function() {
12
- app.alert({
12
+ alerts.alert({
13
13
  type: 'success',
14
14
  alert_id: 'sso-facebook-saved',
15
15
  title: 'Settings Saved',
@@ -1,54 +1,51 @@
1
- <div class="row">
2
- <div class="col-12">
3
- <div class="card">
4
- <div class="card-header">Facebook Social Authentication</div>
5
- <div class="card-body">
6
- <p>
7
- Create a <strong>Facebook Application</strong> via the
8
- <a href="https://developers.facebook.com/apps/">Facebook Developers Page</a> and
9
- then paste your application details here.
10
- </p>
11
- <ul>
12
- <li>
13
- You will need to enable <strong>"Client OAuth Login"</strong> and <strong>"Web OAuth Login"</strong>
14
- from the "Facebook Login" product
15
- </li>
16
- <li>
17
- You will need to paste <code>{baseUrl}/auth/facebook/callback</code> into the
18
- <strong>"Valid OAuth Redirect URIs"</strong> field.
19
- </li>
20
- </ul>
1
+ <div class="acp-page-container">
2
+ <!-- IMPORT admin/partials/settings/header.tpl -->
3
+
4
+ <div class="row m-0">
5
+ <div id="spy-container" class="col-12 px-0 mb-4" tabindex="0">
6
+ <p>
7
+ Create a <strong>Facebook Application</strong> via the
8
+ <a href="https://developers.facebook.com/apps/">Facebook Developers Page</a> and
9
+ then paste your application details here.
10
+ </p>
11
+ <ul>
12
+ <li>
13
+ You will need to enable <strong>"Client OAuth Login"</strong> and <strong>"Web OAuth Login"</strong>
14
+ from the "Facebook Login" product
15
+ </li>
16
+ <li>
17
+ You will need to paste <code>{baseUrl}/auth/facebook/callback</code> into the
18
+ <strong>"Valid OAuth Redirect URIs"</strong> field.
19
+ </li>
20
+ </ul>
21
+ </p>
22
+ <form role="form" class="sso-facebook-settings">
23
+ <div class="mb-3">
24
+ <label for="app_id">Application ID</label>
25
+ <input type="text" id="app_id" name="app_id" title="Application ID" class="form-control" placeholder="Application ID"><br />
26
+ </div>
27
+ <div class="mb-3">
28
+ <label for="secret">Secret</label>
29
+ <input type="text" id="secret" name="secret" title="Secret" class="form-control" placeholder="Secret">
30
+ </div>
31
+ <div class="form-check">
32
+ <input type="checkbox" class="form-check-input" id="autoconfirm" name="autoconfirm" />
33
+ <label for="autoconfirm" class="form-check-label">
34
+ Skip email verification for people who register using SSO?
35
+ </label>
36
+ </div>
37
+ <div class="form-check">
38
+ <input type="checkbox" class="form-check-input" id="disableRegistration" name="disableRegistration" />
39
+ <label for="disableRegistration" class="form-check-label">
40
+ Disable user registration via SSO
41
+ </label>
42
+ </div>
43
+ <p class="form-text">
44
+ Restricting registration means that only registered users can associate their account with this SSO strategy.
45
+ This restriction is useful if you have users bypassing registration controls by using social media accounts, or
46
+ if you wish to use the NodeBB registration queue.
21
47
  </p>
22
- <form role="form" class="sso-facebook-settings">
23
- <div class="mb-3">
24
- <label for="app_id">Application ID</label>
25
- <input type="text" id="app_id" name="app_id" title="Application ID" class="form-control" placeholder="Application ID"><br />
26
- </div>
27
- <div class="mb-3">
28
- <label for="secret">Secret</label>
29
- <input type="text" id="secret" name="secret" title="Secret" class="form-control" placeholder="Secret">
30
- </div>
31
- <div class="form-check">
32
- <input type="checkbox" class="form-check-input" id="autoconfirm" name="autoconfirm" />
33
- <label for="autoconfirm" class="form-check-label">
34
- Skip email verification for people who register using SSO?
35
- </label>
36
- </div>
37
- <div class="form-check">
38
- <input type="checkbox" class="form-check-input" id="disableRegistration" name="disableRegistration" />
39
- <label for="disableRegistration" class="form-check-label">
40
- Disable user registration via SSO
41
- </label>
42
- </div>
43
- <p class="form-text">
44
- Restricting registration means that only registered users can associate their account with this SSO strategy.
45
- This restriction is useful if you have users bypassing registration controls by using social media accounts, or
46
- if you wish to use the NodeBB registration queue.
47
- </p>
48
- </form>
49
- </div>
48
+ </form>
50
49
  </div>
51
50
  </div>
52
51
  </div>
53
-
54
- <!-- IMPORT admin/partials/save_button.tpl -->