mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 08:55:47 +01:00
more fixes
This commit is contained in:
@@ -458,7 +458,7 @@ var socket,
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
app.updateHeader = function(data) {
|
app.updateHeader = function(err, data) {
|
||||||
$('#search-button').off().on('click', function(e) {
|
$('#search-button').off().on('click', function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
$('#search-fields').removeClass('hide').show();
|
$('#search-fields').removeClass('hide').show();
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ define(function() {
|
|||||||
socket.emit('user.emailExists', {
|
socket.emit('user.emailExists', {
|
||||||
email: emailEl.val()
|
email: emailEl.val()
|
||||||
}, function(exists) {
|
}, function(exists) {
|
||||||
if (exists === true) {
|
if (exists) {
|
||||||
showError(email_notify, 'Email address already taken!');
|
showError(email_notify, 'Email address already taken!');
|
||||||
} else {
|
} else {
|
||||||
showSuccess(email_notify, successIcon);
|
showSuccess(email_notify, successIcon);
|
||||||
@@ -73,6 +73,16 @@ define(function() {
|
|||||||
} else {
|
} else {
|
||||||
socket.emit('user.exists', {
|
socket.emit('user.exists', {
|
||||||
username: username.val()
|
username: username.val()
|
||||||
|
}, function(err, exists) {
|
||||||
|
if(err) {
|
||||||
|
return app.alertError(err.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exists) {
|
||||||
|
showError(username_notify, 'Username already taken!');
|
||||||
|
} else {
|
||||||
|
showSuccess(username_notify, successIcon);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,6 +90,7 @@ define(function() {
|
|||||||
username.on('keyup', function() {
|
username.on('keyup', function() {
|
||||||
jQuery('#yourUsername').html(this.value.length > 0 ? this.value : 'username');
|
jQuery('#yourUsername').html(this.value.length > 0 ? this.value : 'username');
|
||||||
});
|
});
|
||||||
|
|
||||||
username.on('blur', function() {
|
username.on('blur', function() {
|
||||||
validateUsername();
|
validateUsername();
|
||||||
});
|
});
|
||||||
@@ -123,16 +134,6 @@ define(function() {
|
|||||||
validatePasswordConfirm();
|
validatePasswordConfirm();
|
||||||
});
|
});
|
||||||
|
|
||||||
ajaxify.register_events(['user.exists', 'user.emailExists']);
|
|
||||||
|
|
||||||
socket.on('user.exists', function(data) {
|
|
||||||
if (data.exists === true) {
|
|
||||||
showError(username_notify, 'Username already taken!');
|
|
||||||
} else {
|
|
||||||
showSuccess(username_notify, successIcon);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
validationError = false;
|
validationError = false;
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,19 @@ SocketMeta.buildTitle = function(socket, text, callback) {
|
|||||||
SocketMeta.updateHeader = function(socket, data, callback) {
|
SocketMeta.updateHeader = function(socket, data, callback) {
|
||||||
if (socket.uid) {
|
if (socket.uid) {
|
||||||
user.getUserFields(socket.uid, data.fields, function(err, fields) {
|
user.getUserFields(socket.uid, data.fields, function(err, fields) {
|
||||||
if (!err && fields) {
|
if(err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fields) {
|
||||||
fields.uid = socket.uid;
|
fields.uid = socket.uid;
|
||||||
callback(fields);
|
callback(null, fields);
|
||||||
|
} else {
|
||||||
|
callback([]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback({
|
callback(null, {
|
||||||
uid: 0,
|
uid: 0,
|
||||||
username: "Anonymous User",
|
username: "Anonymous User",
|
||||||
email: '',
|
email: '',
|
||||||
|
|||||||
Reference in New Issue
Block a user