From da1a1d593037a98becdc63f3668a7dab1ffb977a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Tue, 18 Mar 2014 20:21:24 -0400 Subject: [PATCH] adding callback to settings.load, and omitting password validation check on user creation if no password is entered (e.g. SSO login) --- public/src/modules/settings.js | 5 ++++- src/user/create.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/public/src/modules/settings.js b/public/src/modules/settings.js index 288b3b1a03..129f4882d1 100644 --- a/public/src/modules/settings.js +++ b/public/src/modules/settings.js @@ -16,12 +16,15 @@ define(function() { var Settings = {}; - Settings.load = function(hash, formEl) { + Settings.load = function(hash, formEl, callback) { socket.emit('admin.settings.get', { hash: hash }, function(err, values) { if (!err) { $(formEl).deserialize(values); + if (typeof callback === 'function') { + callback(); + } } else { console.log('[settings] Unable to load settings for hash: ', hash); } diff --git a/src/user/create.js b/src/user/create.js index 6e39ae047a..c6e4ae4771 100644 --- a/src/user/create.js +++ b/src/user/create.js @@ -27,7 +27,11 @@ module.exports = function(User) { next((!utils.isUserNameValid(userData.username) || !userData.userslug) ? new Error('Invalid Username!') : null); }, function(next) { - next(!utils.isPasswordValid(userData.password) ? new Error('Invalid Password!') : null); + if (userData.password) { + next(!utils.isPasswordValid(userData.password) ? new Error('Invalid Password!') : null); + } else { + next(); + } }, function(next) { User.exists(userData.userslug, function(err, exists) {