show alert if email not confirmed, clicking alert will send confirmation
email
This commit is contained in:
barisusakli
2014-07-03 09:36:41 -04:00
parent a960f53f92
commit dcbed4e935
5 changed files with 37 additions and 8 deletions

View File

@@ -6,7 +6,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader'], function(head
var AccountEdit = {},
gravatarPicture = '',
uploadedPicture = '',
selectedImageType = '';
selectedImageType = '',
currentEmail;
AccountEdit.init = function() {
gravatarPicture = ajaxify.variables.get('gravatarpicture');
@@ -22,6 +23,8 @@ define('forum/account/edit', ['forum/account/header', 'uploader'], function(head
yearRange: '1900:+0'
});
currentEmail = $('#inputEmail').val();
handleImageChange();
handleImageUpload();
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-header-name').text(userData.username);
}
if (currentEmail !== data.email) {
currentEmail = data.email;
$('#confirm-email').removeClass('hide');
}
});
return false;

View File

@@ -394,6 +394,10 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting
function done(err) {
$('.action-bar button').removeAttr('disabled');
if (err) {
if (err.message === '[[error:email-not-confirmed]]') {
return showEmailConfirmAlert(err);
}
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) {
if (composer.posts[post_uuid]) {
$('#cmp-uuid-' + post_uuid).remove();