mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
adding callback to settings.load, and omitting password validation check on user creation if no password is entered (e.g. SSO login)
This commit is contained in:
@@ -16,12 +16,15 @@
|
|||||||
define(function() {
|
define(function() {
|
||||||
var Settings = {};
|
var Settings = {};
|
||||||
|
|
||||||
Settings.load = function(hash, formEl) {
|
Settings.load = function(hash, formEl, callback) {
|
||||||
socket.emit('admin.settings.get', {
|
socket.emit('admin.settings.get', {
|
||||||
hash: hash
|
hash: hash
|
||||||
}, function(err, values) {
|
}, function(err, values) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
$(formEl).deserialize(values);
|
$(formEl).deserialize(values);
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('[settings] Unable to load settings for hash: ', hash);
|
console.log('[settings] Unable to load settings for hash: ', hash);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ module.exports = function(User) {
|
|||||||
next((!utils.isUserNameValid(userData.username) || !userData.userslug) ? new Error('Invalid Username!') : null);
|
next((!utils.isUserNameValid(userData.username) || !userData.userslug) ? new Error('Invalid Username!') : null);
|
||||||
},
|
},
|
||||||
function(next) {
|
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) {
|
function(next) {
|
||||||
User.exists(userData.userslug, function(err, exists) {
|
User.exists(userData.userslug, function(err, exists) {
|
||||||
|
|||||||
Reference in New Issue
Block a user