refactor(emails): remove email validation on client and server side

v1.18.x
Julian Lam 4 years ago
parent 12b2a979a0
commit 7c1d1c777b

@ -9,7 +9,6 @@ define('forum/register', [
var successIcon = '';
Register.init = function () {
var email = $('#email');
var username = $('#username');
var password = $('#password');
var password_confirm = $('#password-confirm');
@ -19,17 +18,12 @@ define('forum/register', [
$('#content #noscript').val('false');
email.on('blur', function () {
if (email.val().length) {
validateEmail(email.val());
}
});
var query = utils.params();
if (query.email && query.token) {
email.val(decodeURIComponent(query.email));
$('#token').val(query.token);
}
// TODO: #9607
// var query = utils.params();
// if (query.email && query.token) {
// email.val(decodeURIComponent(query.email));
// $('#token').val(query.token);
// }
// Update the "others can mention you via" text
username.on('keyup', function () {
@ -58,10 +52,7 @@ define('forum/register', [
validationError = false;
validatePassword(password.val(), password_confirm.val());
validatePasswordConfirm(password.val(), password_confirm.val());
validateEmail(email.val(), function () {
validateUsername(username.val(), callback);
});
validateUsername(username.val(), callback);
}
// Guard against caps lock
@ -119,22 +110,9 @@ define('forum/register', [
});
// Set initial focus
$('#email').focus();
$('#username').focus();
};
function validateEmail(email, callback) {
callback = callback || function () {};
var email_notify = $('#email-notify');
if (!utils.isEmailValid(email)) {
showError(email_notify, '[[error:invalid-email]]');
return callback();
}
showSuccess(email_notify, successIcon);
callback();
}
function validateUsername(username, callback) {
callback = callback || function () {};
@ -175,8 +153,6 @@ define('forum/register', [
showError(password_notify, '[[user:change_password_error]]');
} else if (password === $('#username').val()) {
showError(password_notify, '[[user:password_same_as_username]]');
} else if (password === $('#email').val()) {
showError(password_notify, '[[user:password_same_as_email]]');
} else if (passwordStrength.score < ajaxify.data.minimumPasswordStrength) {
showError(password_notify, '[[user:weak_password]]');
} else {

@ -53,11 +53,12 @@ async function registerAndLoginUser(req, res, userData) {
await authenticationController.doLogin(req, uid);
}
// Distinguish registrations through invites from direct ones
if (userData.token) {
await user.joinGroupsFromInvitation(uid, userData.email);
}
await user.deleteInvitationKey(userData.email);
// TODO: #9607
// // Distinguish registrations through invites from direct ones
// if (userData.token) {
// await user.joinGroupsFromInvitation(uid, userData.email);
// }
// await user.deleteInvitationKey(userData.email);
const next = req.session.returnTo || `${nconf.get('relative_path')}/`;
const complete = await plugins.hooks.fire('filter:register.complete', { uid: uid, next: next });
req.session.returnTo = complete.next;
@ -80,10 +81,6 @@ authenticationController.register = async function (req, res) {
await user.verifyInvitation(userData);
}
if (!userData.email) {
throw new Error('[[error:invalid-email]]');
}
if (
!userData.username ||
userData.username.length < meta.config.minimumUsernameLength ||

Loading…
Cancel
Save