feat: removal of emailExists socket listener

v1.18.x
Julian Lam 4 years ago
parent 04b1f702cd
commit 12b2a979a0

@ -131,22 +131,8 @@ define('forum/register', [
return callback();
}
socket.emit('user.emailExists', {
email: email,
}, function (err, exists) {
if (err) {
app.alertError(err.message);
return callback();
}
if (exists) {
showError(email_notify, '[[error:email-taken]]');
} else {
showSuccess(email_notify, successIcon);
}
callback();
});
showSuccess(email_notify, successIcon);
callback();
}
function validateUsername(username, callback) {

@ -43,13 +43,6 @@ SocketUser.deleteAccount = async function (socket, data) {
await api.users.deleteAccount(socket, data);
};
SocketUser.emailExists = async function (socket, data) {
if (!data || !data.email) {
throw new Error('[[error:invalid-data]]');
}
return await user.email.exists(data.email);
};
SocketUser.emailConfirm = async function (socket) {
if (!socket.uid) {
throw new Error('[[error:no-privileges]]');

@ -1766,29 +1766,6 @@ describe('User', () => {
meta.config.allowAccountDeletion = oldValue;
});
it('should fail if data is invalid', (done) => {
socketUser.emailExists({ uid: testUid }, null, (err) => {
assert.equal(err.message, '[[error:invalid-data]]');
done();
});
});
it('should return true if email exists', (done) => {
socketUser.emailExists({ uid: testUid }, { email: 'john@example.com' }, (err, exists) => {
assert.ifError(err);
assert(exists);
done();
});
});
it('should return false if email does not exist', (done) => {
socketUser.emailExists({ uid: testUid }, { email: 'does@not.exist' }, (err, exists) => {
assert.ifError(err);
assert(!exists);
done();
});
});
it('should error if requireEmailConfirmation is disabled', (done) => {
socketUser.emailConfirm({ uid: testUid }, {}, (err) => {
assert.equal(err.message, '[[error:email-confirmations-are-disabled]]');

Loading…
Cancel
Save