mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
closes #1763
show alert if email not confirmed, clicking alert will send confirmation email
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
"username-taken": "Username taken",
|
"username-taken": "Username taken",
|
||||||
"email-taken": "Email taken",
|
"email-taken": "Email taken",
|
||||||
"email-not-confirmed": "Your email is not confirmed",
|
"email-not-confirmed": "Your email is not confirmed, please click here to confirm your email.",
|
||||||
|
|
||||||
"username-too-short": "Username too short",
|
"username-too-short": "Username too short",
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
"username": "User Name",
|
"username": "User Name",
|
||||||
|
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
"email.confirmed": "Confirmed",
|
"confirm_email": "Confirm Email",
|
||||||
"email.not_confirmed": "Not Confirmed",
|
|
||||||
"email.confirm_button_text": "Resend Confirmation",
|
|
||||||
|
|
||||||
"fullname": "Full Name",
|
"fullname": "Full Name",
|
||||||
"website": "Website",
|
"website": "Website",
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader'], function(head
|
|||||||
var AccountEdit = {},
|
var AccountEdit = {},
|
||||||
gravatarPicture = '',
|
gravatarPicture = '',
|
||||||
uploadedPicture = '',
|
uploadedPicture = '',
|
||||||
selectedImageType = '';
|
selectedImageType = '',
|
||||||
|
currentEmail;
|
||||||
|
|
||||||
AccountEdit.init = function() {
|
AccountEdit.init = function() {
|
||||||
gravatarPicture = ajaxify.variables.get('gravatarpicture');
|
gravatarPicture = ajaxify.variables.get('gravatarpicture');
|
||||||
@@ -22,6 +23,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader'], function(head
|
|||||||
yearRange: '1900:+0'
|
yearRange: '1900:+0'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
currentEmail = $('#inputEmail').val();
|
||||||
|
|
||||||
handleImageChange();
|
handleImageChange();
|
||||||
handleImageUpload();
|
handleImageUpload();
|
||||||
handleEmailConfirm();
|
handleEmailConfirm();
|
||||||
@@ -70,6 +73,11 @@ define('forum/account/edit', ['forum/account/header', 'uploader'], function(head
|
|||||||
$('#user-profile-link').attr('href', config.relative_path + '/user/' + data.userslug);
|
$('#user-profile-link').attr('href', config.relative_path + '/user/' + data.userslug);
|
||||||
$('#user-header-name').text(userData.username);
|
$('#user-header-name').text(userData.username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentEmail !== data.email) {
|
||||||
|
currentEmail = data.email;
|
||||||
|
$('#confirm-email').removeClass('hide');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -394,6 +394,10 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
function done(err) {
|
function done(err) {
|
||||||
$('.action-bar button').removeAttr('disabled');
|
$('.action-bar button').removeAttr('disabled');
|
||||||
if (err) {
|
if (err) {
|
||||||
|
if (err.message === '[[error:email-not-confirmed]]') {
|
||||||
|
return showEmailConfirmAlert(err);
|
||||||
|
}
|
||||||
|
|
||||||
return app.alertError(err.message);
|
return app.alertError(err.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,6 +406,25 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showEmailConfirmAlert(err) {
|
||||||
|
app.alert({
|
||||||
|
id: 'email_confirm',
|
||||||
|
title: '[[global:alert.error]]',
|
||||||
|
message: err.message,
|
||||||
|
type: 'danger',
|
||||||
|
timeout: 0,
|
||||||
|
clickfn: function() {
|
||||||
|
app.removeAlert('email_confirm');
|
||||||
|
socket.emit('user.emailConfirm', {}, function(err) {
|
||||||
|
if (err) {
|
||||||
|
return app.alertError(err.message);
|
||||||
|
}
|
||||||
|
app.alertSuccess('[[notifications:email-confirm-sent]]');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function discard(post_uuid) {
|
function discard(post_uuid) {
|
||||||
if (composer.posts[post_uuid]) {
|
if (composer.posts[post_uuid]) {
|
||||||
$('#cmp-uuid-' + post_uuid).remove();
|
$('#cmp-uuid-' + post_uuid).remove();
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ module.exports = function(User) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
User.getUserFields(uid, ['userslug', 'picture', 'gravatarpicture'], callback);
|
User.getUserFields(uid, ['email', 'userslug', 'picture', 'gravatarpicture'], callback);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ module.exports = function(User) {
|
|||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(userData.email === newEmail) {
|
if (userData.email === newEmail) {
|
||||||
return callback();
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user