From 78863a438f32e3f2f826e8c815d2fe4ca6a2b920 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 22 Sep 2015 14:27:44 -0400 Subject: [PATCH] Firing new hook `filter:auth.list` This new plugins allows SSO services to list whether a user has authenticated via that service, and will display as such in the user's profile editing screen. --- public/language/en_GB/user.json | 6 +++++- src/controllers/accounts.js | 7 ++++++- src/file.js | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/public/language/en_GB/user.json b/public/language/en_GB/user.json index b4d3dcaaf5..9a019791be 100644 --- a/public/language/en_GB/user.json +++ b/public/language/en_GB/user.json @@ -101,5 +101,9 @@ "grouptitle": "Select the group title you would like to display", "no-group-title": "No group title", - "select-skin": "Select a Skin" + "select-skin": "Select a Skin", + + "sso.title": "Single Sign-on Services", + "sso.associated": "Associated with", + "sso.not-associated": "Click here to associate with" } diff --git a/src/controllers/accounts.js b/src/controllers/accounts.js index 18f2be4bef..174bb6be5c 100644 --- a/src/controllers/accounts.js +++ b/src/controllers/accounts.js @@ -49,7 +49,11 @@ function getUserDataByUserSlug(userslug, callerUID, callback) { }, groups: function(next) { groups.getUserGroups([uid], next); - } + }, + sso: async.apply(plugins.fireHook, 'filter:auth.list', { + uid: uid, + associations: [] + }) }, function(err, results) { if (err || !results.userData) { return callback(err || new Error('[[error:invalid-uid]]')); @@ -88,6 +92,7 @@ function getUserDataByUserSlug(userslug, callerUID, callback) { userData.disableSignatures = meta.config.disableSignatures !== undefined && parseInt(meta.config.disableSignatures, 10) === 1; userData['email:confirmed'] = !!parseInt(userData['email:confirmed'], 10); userData.profile_links = results.profile_links; + userData.sso = results.sso.associations; userData.status = require('../socket.io').isUserOnline(userData.uid) ? (userData.status || 'online') : 'offline'; userData.banned = parseInt(userData.banned, 10) === 1; userData.website = validator.escape(userData.website); diff --git a/src/file.js b/src/file.js index b606c43afc..94465b4ad7 100644 --- a/src/file.js +++ b/src/file.js @@ -55,7 +55,7 @@ file.isFileTypeAllowed = function(path, allowedExtensions, callback) { var uploadedFileExtension = mime.extension(mimeType); if (allowedExtensions.indexOf(uploadedFileExtension) === -1) { - return callback(new Error('[[error:invalid-file-type, ' + allowedExtensions.join('-') + ']]')); + return callback(new Error('[[error:invalid-file-type, ' + allowedExtensions.join(', ') + ']]')); } callback();