nodebb-plugin-sso-facebook 4.1.3 → 4.2.0

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.
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ import serverConfig from 'eslint-config-nodebb';
4
+ import publicConfig from 'eslint-config-nodebb/public';
5
+
6
+ export default [
7
+ ...publicConfig,
8
+ ...serverConfig,
9
+ ];
10
+
package/library.js CHANGED
@@ -1,318 +1,316 @@
1
- (function (module) {
2
- 'use strict';
3
- /* globals module, require */
4
-
5
- var user = require.main.require('./src/user'),
6
- meta = require.main.require('./src/meta'),
7
- db = require.main.require('./src/database'),
8
- passport = require.main.require('passport'),
9
- passportFacebook = require('passport-facebook').Strategy,
10
- nconf = require.main.require('nconf'),
11
- async = require.main.require('async'),
12
- winston = require.main.require('winston');
13
-
14
- var authenticationController = require.main.require('./src/controllers/authentication');
15
-
16
- var constants = Object.freeze({
17
- 'name': 'Facebook',
18
- 'admin': {
19
- 'route': '/plugins/sso-facebook',
20
- 'icon': 'fa-facebook-square'
21
- }
22
- });
23
1
 
24
- var Facebook = {
25
- settings: undefined
26
- };
2
+ 'use strict';
27
3
 
28
- Facebook.init = function (params, callback) {
29
- const hostHelpers = require.main.require('./src/routes/helpers');
4
+ const passport = require.main.require('passport');
5
+ const passportFacebook = require('passport-facebook').Strategy;
6
+ const nconf = require.main.require('nconf');
7
+ const winston = require.main.require('winston');
30
8
 
31
- hostHelpers.setupAdminPageRoute(params.router, '/admin/plugins/sso-facebook', function (req, res) {
32
- res.render('admin/plugins/sso-facebook', {
33
- title: constants.name,
34
- baseUrl: nconf.get('url'),
35
- });
36
- });
9
+ const user = require.main.require('./src/user');
10
+ const meta = require.main.require('./src/meta');
11
+ const db = require.main.require('./src/database');
37
12
 
38
- hostHelpers.setupPageRoute(params.router, '/deauth/facebook', [params.middleware.requireUser], function (req, res) {
39
- res.render('plugins/sso-facebook/deauth', {
40
- service: "Facebook",
41
- });
42
- });
43
- params.router.post('/deauth/facebook', [params.middleware.requireUser, params.middleware.applyCSRF], hostHelpers.tryRoute(async function (req, res, next) {
44
- await Facebook.deleteUserData({
45
- uid: req.user.uid,
46
- });
47
- res.redirect(nconf.get('relative_path') + '/me/edit');
48
- }));
13
+ const constants = Object.freeze({
14
+ 'name': 'Facebook',
15
+ 'admin': {
16
+ 'route': '/plugins/sso-facebook',
17
+ 'icon': 'fa-facebook-square',
18
+ },
19
+ });
49
20
 
50
- callback();
51
- };
21
+ const Facebook = {
22
+ settings: undefined,
23
+ };
52
24
 
53
- Facebook.getSettings = function (callback) {
54
- if (Facebook.settings) {
55
- return callback();
56
- }
25
+ Facebook.init = async function (params) {
26
+ const hostHelpers = require.main.require('./src/routes/helpers');
57
27
 
58
- meta.settings.get('sso-facebook', function (err, settings) {
59
- Facebook.settings = settings;
60
- callback();
28
+ hostHelpers.setupAdminPageRoute(params.router, '/admin/plugins/sso-facebook', function (req, res) {
29
+ res.render('admin/plugins/sso-facebook', {
30
+ title: constants.name,
31
+ baseUrl: nconf.get('url'),
61
32
  });
33
+ });
34
+
35
+ hostHelpers.setupPageRoute(params.router, '/deauth/facebook', [params.middleware.requireUser], function (req, res) {
36
+ res.render('plugins/sso-facebook/deauth', {
37
+ service: constants.name,
38
+ });
39
+ });
40
+ params.router.post('/deauth/facebook', [params.middleware.requireUser, params.middleware.applyCSRF], hostHelpers.tryRoute(async function (req, res) {
41
+ await Facebook.deleteUserData({
42
+ uid: req.user.uid,
43
+ });
44
+ res.redirect(nconf.get('relative_path') + '/me/edit');
45
+ }));
46
+ };
47
+
48
+ Facebook.getSettings = async function () {
49
+ if (Facebook.settings) {
50
+ return;
62
51
  }
63
52
 
64
- Facebook.getStrategy = function (strategies, callback) {
65
- if (!Facebook.settings) {
66
- return Facebook.getSettings(function () {
67
- Facebook.getStrategy(strategies, callback);
68
- });
69
- }
53
+ Facebook.settings = await meta.settings.get('sso-facebook');
54
+ };
70
55
 
71
- if (
72
- Facebook.settings !== undefined &&
73
- Facebook.settings.hasOwnProperty('app_id') && Facebook.settings.app_id &&
74
- Facebook.settings.hasOwnProperty('secret') && Facebook.settings.secret
75
- ) {
76
- passport.use(new passportFacebook({
77
- clientID: Facebook.settings.app_id,
78
- clientSecret: Facebook.settings.secret,
79
- callbackURL: nconf.get('url') + '/auth/facebook/callback',
80
- passReqToCallback: true,
81
- profileFields: ['id', 'emails', 'name', 'displayName'],
82
- enableProof: true,
83
- }, function (req, accessToken, refreshToken, profile, done) {
56
+ Facebook.getStrategy = async function (strategies) {
57
+ if (!Facebook.settings) {
58
+ await Facebook.getSettings();
59
+ return Facebook.getStrategy(strategies);
60
+ }
61
+
62
+ if (
63
+ Facebook.settings !== undefined &&
64
+ Facebook.settings.hasOwnProperty('app_id') && Facebook.settings.app_id &&
65
+ Facebook.settings.hasOwnProperty('secret') && Facebook.settings.secret
66
+ ) {
67
+ passport.use(new passportFacebook({
68
+ clientID: Facebook.settings.app_id,
69
+ clientSecret: Facebook.settings.secret,
70
+ callbackURL: nconf.get('url') + '/auth/facebook/callback',
71
+ passReqToCallback: true,
72
+ profileFields: ['id', 'emails', 'name', 'displayName'],
73
+ enableProof: true,
74
+ }, async function (req, accessToken, refreshToken, profile, done) {
75
+ try {
84
76
  if (req.hasOwnProperty('user') && req.user.hasOwnProperty('uid') && req.user.uid > 0) {
85
77
  // User is already logged-in, associate fb account with uid if account does not have an existing association
86
- user.getUserField(req.user.uid, 'fbid', function (err, fbid) {
87
- if (err) {
88
- return done(err);
89
- }
90
-
91
- if (!fbid || profile.id === fbid) {
92
- user.setUserField(req.user.uid, 'fbid', profile.id);
93
- db.setObjectField('fbid:uid', profile.id, req.user.uid);
94
- done(null, req.user);
95
- } else {
96
- done(new Error('[[error:sso-multiple-association]]'));
97
- }
98
- });
78
+ const fbid = await user.getUserField(req.user.uid, 'fbid');
79
+ if (!fbid || profile.id === fbid) {
80
+ await user.setUserField(req.user.uid, 'fbid', profile.id);
81
+ await db.setObjectField('fbid:uid', profile.id, req.user.uid);
82
+ done(null, req.user);
83
+ } else {
84
+ done(new Error('[[error:sso-multiple-association]]'));
85
+ }
99
86
  } else {
100
- var email;
87
+ let email;
101
88
  if (profile._json.hasOwnProperty('email')) {
102
89
  email = profile._json.email;
103
90
  } else {
104
91
  email = (profile.username ? profile.username : profile.id) + '@facebook.com';
105
92
  }
106
93
 
107
- Facebook.login(profile.id, profile.displayName, email, 'https://graph.facebook.com/' + profile.id + '/picture?type=large', accessToken, refreshToken, profile, function (err, user) {
108
- if (err) {
109
- return done(err);
110
- }
111
-
112
- // Require collection of email
113
- if (email.endsWith('@facebook.com')) {
114
- req.session.registration = req.session.registration || {};
115
- req.session.registration.uid = user.uid;
116
- req.session.registration.fbid = profile.id;
117
- }
118
-
119
- authenticationController.onSuccessfulLogin(req, user.uid, function (err) {
120
- done(err, !err ? user : null);
121
- });
122
- });
123
- }
124
- }));
125
-
126
- strategies.push({
127
- name: 'facebook',
128
- url: '/auth/facebook',
129
- callbackURL: '/auth/facebook/callback',
130
- icon: constants.admin.icon,
131
- icons: {
132
- normal: 'fa-brands fa-facebook',
133
- square: 'fa-brands fa-facebook-square',
134
- },
135
- labels: {
136
- login: '[[social:log-in-with-facebook]]',
137
- register: '[[social:continue-with-facebook]]',
138
- },
139
- color: '#5165b2',
140
- scope: 'public_profile, email'
141
- });
142
- }
143
-
144
- callback(null, strategies);
145
- };
94
+ const { queued, uid, message } = await Facebook.login(req, profile.id, profile.displayName, email, 'https://graph.facebook.com/' + profile.id + '/picture?type=large', accessToken, refreshToken);
146
95
 
147
- Facebook.appendUserHashWhitelist = function (data, callback) {
148
- data.whitelist.push('fbid');
149
- setImmediate(callback, null, data);
150
- };
151
-
152
- Facebook.getAssociation = function (data, callback) {
153
- user.getUserField(data.uid, 'fbid', function (err, fbId) {
154
- if (err) {
155
- return callback(err, data);
156
- }
157
-
158
- if (fbId) {
159
- data.associations.push({
160
- associated: true,
161
- url: 'https://facebook.com/' + fbId,
162
- deauthUrl: nconf.get('url') + '/deauth/facebook',
163
- name: constants.name,
164
- icon: constants.admin.icon
165
- });
166
- } else {
167
- data.associations.push({
168
- associated: false,
169
- url: nconf.get('url') + '/auth/facebook',
170
- name: constants.name,
171
- icon: constants.admin.icon
172
- });
173
- }
96
+ if (queued) {
97
+ return done(null, false, { message });
98
+ }
174
99
 
175
- callback(null, data);
176
- })
177
- };
100
+ // Require collection of email
101
+ if (email.endsWith('@facebook.com')) {
102
+ req.session.registration = req.session.registration || {};
103
+ req.session.registration.uid = user.uid;
104
+ req.session.registration.fbid = profile.id;
105
+ }
178
106
 
179
- Facebook.prepareInterstitial = function (data, callback) {
180
- // Only execute if:
181
- // - uid and fbid are set in session
182
- // - email ends with "@facebook.com"
183
- if (data.userData.hasOwnProperty('uid') && data.userData.hasOwnProperty('fbid')) {
184
- user.getUserField(data.userData.uid, 'email', function (err, email) {
185
- if (email && email.endsWith('@facebook.com')) {
186
- data.interstitials.push({
187
- template: 'partials/sso-facebook/email.tpl',
188
- data: {},
189
- callback: Facebook.storeAdditionalData
190
- });
107
+ done(null, { uid });
191
108
  }
109
+ } catch (err) {
110
+ done(err);
111
+ }
112
+ }));
192
113
 
193
- callback(null, data);
194
- });
195
- } else {
196
- callback(null, data);
197
- }
198
- };
199
-
200
- Facebook.storeAdditionalData = function (userData, data, callback) {
201
- async.waterfall([
202
- // Reset email confirm throttle
203
- async.apply(db.delete, 'uid:' + userData.uid + ':confirm:email:sent'),
204
- function (next) {
205
- user.getUserField(userData.uid, 'email', next);
114
+ strategies.push({
115
+ name: 'facebook',
116
+ url: '/auth/facebook',
117
+ callbackURL: '/auth/facebook/callback',
118
+ icon: constants.admin.icon,
119
+ icons: {
120
+ normal: 'fa-brands fa-facebook',
121
+ square: 'fa-brands fa-facebook-square',
206
122
  },
207
- function (email, next) {
208
- db.sortedSetRemove('email:uid', email, next);
123
+ labels: {
124
+ login: '[[social:log-in-with-facebook]]',
125
+ register: '[[social:continue-with-facebook]]',
209
126
  },
210
- async.apply(user.setUserField, userData.uid, 'email', data.email),
211
- async.apply(user.email.sendValidationEmail, userData.uid, data.email)
212
- ], callback);
213
- };
214
-
215
- Facebook.storeTokens = function (uid, accessToken, refreshToken) {
216
- //JG: Actually save the useful stuff
217
- winston.verbose("Storing received fb access information for uid(" + uid + ") accessToken(" + accessToken + ") refreshToken(" + refreshToken + ")");
218
- user.setUserField(uid, 'fbaccesstoken', accessToken);
219
- user.setUserField(uid, 'fbrefreshtoken', refreshToken);
220
- };
221
-
222
- Facebook.login = function (fbid, name, email, picture, accessToken, refreshToken, profile, callback) {
223
- winston.verbose("Facebook.login fbid, name, email, picture: " + fbid + ", " + name + ", " + email + ", " + picture);
224
- const autoConfirm = Facebook.settings && Facebook.settings.autoconfirm === "on" ? 1 : 0;
225
-
226
- Facebook.getUidByFbid(fbid, function (err, uid) {
227
- if (err) {
228
- return callback(err);
229
- }
230
-
231
- if (uid !== null) {
232
- // Existing User
233
- Facebook.storeTokens(uid, accessToken, refreshToken);
234
-
235
- callback(null, {
236
- uid: uid
237
- });
238
- } else {
239
- // New User
240
- var success = async (uid) => {
241
- // Save facebook-specific information to the user
242
- user.setUserField(uid, 'fbid', fbid);
243
- db.setObjectField('fbid:uid', fbid, uid);
244
-
245
- if (autoConfirm) {
246
- await user.setUserField(uid, 'email', email);
247
- await user.email.confirmByUid(uid);
248
- }
249
-
250
- // Save their photo, if present
251
- if (picture) {
252
- user.setUserField(uid, 'uploadedpicture', picture);
253
- user.setUserField(uid, 'picture', picture);
254
- }
255
-
256
- Facebook.storeTokens(uid, accessToken, refreshToken);
127
+ color: '#5165b2',
128
+ scope: 'public_profile, email',
129
+ });
130
+ }
131
+ };
132
+
133
+ Facebook.appendUserHashWhitelist = function (data) {
134
+ data.whitelist.push('fbid');
135
+ return data;
136
+ };
137
+
138
+ Facebook.getAssociation = async function (data) {
139
+ const fbId = await user.getUserField(data.uid, 'fbid');
140
+ if (fbId) {
141
+ data.associations.push({
142
+ associated: true,
143
+ url: 'https://facebook.com/' + fbId,
144
+ deauthUrl: nconf.get('url') + '/deauth/facebook',
145
+ name: constants.name,
146
+ icon: constants.admin.icon,
147
+ });
148
+ } else {
149
+ data.associations.push({
150
+ associated: false,
151
+ url: nconf.get('url') + '/auth/facebook',
152
+ name: constants.name,
153
+ icon: constants.admin.icon,
154
+ });
155
+ }
156
+ return data;
157
+ };
158
+
159
+ Facebook.prepareInterstitial = async function (data) {
160
+ // Only execute if:
161
+ // - uid and fbid are set in session
162
+ // - email ends with "@facebook.com"
163
+ if (data.userData.hasOwnProperty('uid') && data.userData.hasOwnProperty('fbid')) {
164
+ const email = await user.getUserField(data.userData.uid, 'email');
165
+ if (email && email.endsWith('@facebook.com')) {
166
+ data.interstitials.push({
167
+ template: 'partials/sso-facebook/email.tpl',
168
+ data: {},
169
+ callback: Facebook.storeAdditionalData,
170
+ });
171
+ }
172
+ }
173
+ return data;
174
+ };
175
+
176
+ Facebook.storeAdditionalData = async function (userData, data) {
177
+ await db.delete(`uid:${userData.uid}:confirm:email:sent`);
178
+ const email = await user.getUserField(userData.uid, 'email');
179
+ await db.sortedSetRemove('email:uid', email);
180
+ await user.setUserField(userData.uid, 'email', data.email);
181
+ await user.email.sendValidationEmail(userData.uid, data.email);
182
+ };
183
+
184
+ Facebook.storeTokens = async function (uid, accessToken, refreshToken) {
185
+ //JG: Actually save the useful stuff
186
+ winston.verbose(`Storing received fb access information for uid(${uid}) accessToken(${accessToken}) refreshToken(${refreshToken})`);
187
+ await user.setUserFields(uid, {
188
+ fbaccesstoken: accessToken,
189
+ fbrefreshtoken: refreshToken,
190
+ });
191
+ };
257
192
 
258
- callback(null, {
259
- uid: uid
260
- });
261
- };
193
+ Facebook.login = async function (req, fbid, name, email, picture, accessToken, refreshToken) {
194
+ winston.verbose(`Facebook.login fbid, name, email, picture: ${fbid}, ${name}, ${email}, ${picture}`);
195
+ const autoConfirm = Facebook.settings && Facebook.settings.autoconfirm === 'on' ? 1 : 0;
262
196
 
263
- user.getUidByEmail(email, function (err, uid) {
264
- if (err) {
265
- return callback(err);
266
- }
197
+ let uid = await Facebook.getUidByFbid(fbid);
267
198
 
268
- if (!uid) {
269
- // Abort user creation if registration via SSO is restricted
270
- if (Facebook.settings.disableRegistration === 'on') {
271
- return callback(new Error('[[error:sso-registration-disabled, Facebook]]'));
272
- }
199
+ if (uid) {
200
+ // Existing User
201
+ await Facebook.storeTokens(uid, accessToken, refreshToken);
202
+ return { uid: uid };
203
+ }
273
204
 
274
- user.create({ username: name, email: !autoConfirm ? email : undefined }, function (err, uid) {
275
- if (err) {
276
- return callback(err);
277
- }
205
+ const success = async (uid) => {
206
+ // Save facebook-specific information to the user
207
+ await Promise.all([
208
+ user.setUserField(uid, 'fbid', fbid),
209
+ db.setObjectField('fbid:uid', fbid, uid),
210
+ ]);
211
+
212
+ // Save their photo, if present
213
+ if (picture) {
214
+ await user.setUserFields(uid, {
215
+ uploadedpicture: picture,
216
+ picture: picture,
217
+ });
218
+ }
278
219
 
279
- success(uid);
280
- });
281
- } else {
282
- success(uid); // Existing account -- merge
283
- }
284
- });
285
- }
286
- });
220
+ await Facebook.storeTokens(uid, accessToken, refreshToken);
287
221
  };
288
222
 
289
- Facebook.getUidByFbid = function (fbid, callback) {
290
- db.getObjectField('fbid:uid', fbid, function (err, uid) {
291
- if (err) {
292
- return callback(err);
293
- }
294
- callback(null, uid);
295
- });
296
- };
223
+ uid = await user.getUidByEmail(email);
224
+ if (uid) {
225
+ await success(uid);
226
+ return { uid };
227
+ }
297
228
 
298
- Facebook.addMenuItem = function (custom_header, callback) {
299
- custom_header.authentication.push({
300
- 'route': constants.admin.route,
301
- 'icon': constants.admin.icon,
302
- 'name': constants.name
303
- });
229
+ // Abort user creation if registration via SSO is restricted
230
+ if (Facebook.settings.disableRegistration === 'on') {
231
+ throw new Error('[[error:sso-registration-disabled, Facebook]]');
232
+ }
304
233
 
305
- callback(null, custom_header);
306
- };
234
+ return await user.createOrQueue(req, {
235
+ fbid,
236
+ picture,
237
+ username: name,
238
+ email,
239
+ }, {
240
+ emailVerification: autoConfirm ? 'verify' : 'send',
241
+ });
242
+ };
243
+
244
+ Facebook.addToApprovalQueue = async (hookData) => {
245
+ await saveFacebookSpecificData(hookData.data, hookData.userData);
246
+ return hookData;
247
+ };
248
+
249
+ Facebook.filterUserCreate = async (hookData) => {
250
+ await saveFacebookSpecificData(hookData.user, hookData.data);
251
+ return hookData;
252
+ };
253
+
254
+ async function saveFacebookSpecificData(targetObj, sourceObj) {
255
+ const { fbid, picture } = sourceObj;
256
+ if (fbid) {
257
+ const uid = await Facebook.getUidByFbid(fbid);
258
+ if (uid) {
259
+ throw new Error('[[error:sso-account-exists, Facebook]]');
260
+ }
261
+ targetObj.fbid = fbid;
262
+ if (picture) {
263
+ targetObj.picture = picture;
264
+ targetObj.uploadedpicture = picture;
265
+ }
266
+ }
267
+ }
307
268
 
308
- Facebook.deleteUserData = async function (data) {
309
- const { uid } = data;
310
- const fbid = await user.getUserField(uid, 'fbid');
311
- if (fbid) {
312
- await db.deleteObjectField('fbid:uid', fbid);
313
- await db.deleteObjectField('user:' + uid, 'fbid');
269
+ Facebook.actionUserCreate = async (hookData) => {
270
+ const { uid } = hookData.user;
271
+ const fbid = await user.getUserField(uid, 'fbid');
272
+ if (fbid) {
273
+ await db.setObjectField('fbid:uid', fbid, uid);
274
+ }
275
+ };
276
+
277
+ Facebook.filterUserGetRegistrationQueue = async (hookData) => {
278
+ const { users } = hookData;
279
+ users.forEach((user) => {
280
+ if (user?.fbid) {
281
+ user.sso = {
282
+ icon: 'fa-brands fa-facebook',
283
+ name: constants.name,
284
+ };
314
285
  }
315
- };
286
+ });
287
+ return hookData;
288
+ };
289
+
290
+ Facebook.getUidByFbid = async function (fbid) {
291
+ const uid = await db.getObjectField('fbid:uid', fbid);
292
+ return uid;
293
+ };
294
+
295
+ Facebook.addMenuItem = function (custom_header) {
296
+ custom_header.authentication.push({
297
+ 'route': constants.admin.route,
298
+ 'icon': constants.admin.icon,
299
+ 'name': constants.name,
300
+ });
301
+ return custom_header;
302
+ };
303
+
304
+ Facebook.deleteUserData = async function (data) {
305
+ const { uid } = data;
306
+ const fbid = await user.getUserField(uid, 'fbid');
307
+ if (fbid) {
308
+ await Promise.all([
309
+ db.deleteObjectField('fbid:uid', fbid),
310
+ db.deleteObjectField(`user:${uid}`, 'fbid'),
311
+ ]);
312
+ }
313
+ };
314
+
315
+ module.exports = Facebook;
316
316
 
317
- module.exports = Facebook;
318
- }(module));
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "nodebb-plugin-sso-facebook",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "NodeBB Facebook SSO",
5
5
  "main": "library.js",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/julianlam/nodebb-plugin-sso-facebook"
9
9
  },
10
+ "scripts": {
11
+ "lint": "eslint ."
12
+ },
10
13
  "keywords": [
11
14
  "nodebb",
12
15
  "plugin",
@@ -28,7 +31,11 @@
28
31
  "dependencies": {
29
32
  "passport-facebook": "~1.0.2"
30
33
  },
34
+ "devDependencies": {
35
+ "eslint": "10.0.2",
36
+ "eslint-config-nodebb": "^2.0.0"
37
+ },
31
38
  "nbbpm": {
32
- "compatibility": "^4.0.0"
39
+ "compatibility": "^4.9.0"
33
40
  }
34
41
  }
package/plugin.json CHANGED
@@ -12,7 +12,11 @@
12
12
  { "hook": "filter:admin.header.build", "method": "addMenuItem" },
13
13
  { "hook": "static:user.delete", "method": "deleteUserData" },
14
14
  { "hook": "filter:register.interstitial", "method": "prepareInterstitial" },
15
- { "hook": "filter:user.whitelistFields", "method": "appendUserHashWhitelist" }
15
+ { "hook": "filter:user.whitelistFields", "method": "appendUserHashWhitelist" },
16
+ { "hook": "filter:user.addToApprovalQueue", "method": "addToApprovalQueue" },
17
+ { "hook": "filter:user.create", "method": "filterUserCreate" },
18
+ { "hook": "action:user.create", "method": "actionUserCreate" },
19
+ { "hook": "filter:user.getRegistrationQueue", "method": "filterUserGetRegistrationQueue" }
16
20
  ],
17
21
  "modules": {
18
22
  "../admin/plugins/sso-facebook.js": "static/lib/admin.js"
@@ -1,22 +1,20 @@
1
- define('admin/plugins/sso-facebook', ['settings', 'alerts'], function(Settings, alerts) {
1
+ define('admin/plugins/sso-facebook', ['settings', 'alerts'], function (Settings, alerts) {
2
2
  'use strict';
3
- /* globals $, app, socket, require */
3
+ const ACP = {};
4
4
 
5
- var ACP = {};
6
-
7
- ACP.init = function() {
5
+ ACP.init = function () {
8
6
  Settings.load('sso-facebook', $('.sso-facebook-settings'));
9
7
 
10
- $('#save').on('click', function() {
11
- Settings.save('sso-facebook', $('.sso-facebook-settings'), function() {
8
+ $('#save').on('click', function () {
9
+ Settings.save('sso-facebook', $('.sso-facebook-settings'), function () {
12
10
  alerts.alert({
13
11
  type: 'success',
14
12
  alert_id: 'sso-facebook-saved',
15
13
  title: 'Settings Saved',
16
14
  message: 'Please reload your NodeBB to apply these settings',
17
- clickfn: function() {
15
+ clickfn: function () {
18
16
  socket.emit('admin.reload');
19
- }
17
+ },
20
18
  });
21
19
  });
22
20
  });