Node.js based forum software built for the modern web
feat: removal of emailExists socket listener
Julian Lam12b2a979a075
diff --git a/public/src/client/register.js b/public/src/client/register.jsindex 400ab9a870..92ec1a0e8f 100644--- a/public/src/client/register.js+++ b/public/src/client/register.js@@ -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) {diff --git a/src/socket.io/user.js b/src/socket.io/user.jsindex 1d213600a2..3e324a6211 100644--- a/src/socket.io/user.js+++ b/src/socket.io/user.js@@ -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]]');diff --git a/test/user.js b/test/user.jsindex 602a123178..2b68a4415c 100644--- a/test/user.js+++ b/test/user.js@@ -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: '[email protected]' }, (err, exists) => {- assert.ifError(err);- assert(exists);- done();- });- });-- it('should return false if email does not exist', (done) => {- socketUser.emailExists({ uid: testUid }, { email: '[email protected]' }, (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]]');