mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 04:25:55 +01:00
tweaks and refactoring for #2774
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
"email-not-confirmed": "Your email has not been confirmed yet, please click here to confirm your email.",
|
"email-not-confirmed": "Your email has not been confirmed yet, please click here to confirm your email.",
|
||||||
"email-not-confirmed-chat": "You are unable to chat until your email is confirmed",
|
"email-not-confirmed-chat": "You are unable to chat until your email is confirmed",
|
||||||
"no-email-to-confirm": "This forum requires email confirmation, please click here to enter an email",
|
"no-email-to-confirm": "This forum requires email confirmation, please click here to enter an email",
|
||||||
|
"email-confirm-failed": "We could not confirm your email, please try again later.",
|
||||||
|
|
||||||
"username-too-short": "Username too short",
|
"username-too-short": "Username too short",
|
||||||
"username-too-long": "Username too long",
|
"username-too-long": "Username too long",
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
"email-confirmed": "Email Confirmed",
|
"email-confirmed": "Email Confirmed",
|
||||||
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
|
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
|
||||||
"email-confirm-error": "An error occurred...",
|
|
||||||
"email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.",
|
"email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.",
|
||||||
"email-confirm-sent": "Confirmation email sent."
|
"email-confirm-sent": "Confirmation email sent."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,9 +119,10 @@ Controllers.register = function(req, res, next) {
|
|||||||
|
|
||||||
|
|
||||||
Controllers.confirmEmail = function(req, res, next) {
|
Controllers.confirmEmail = function(req, res, next) {
|
||||||
user.email.confirm(req.params.code, function (data) {
|
user.email.confirm(req.params.code, function (err) {
|
||||||
data.status = data.status === 'ok';
|
res.render('confirm', {
|
||||||
res.render('confirm', data);
|
error: err ? err.message : ''
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -87,21 +87,18 @@ var async = require('async'),
|
|||||||
UserEmail.confirm = function(code, callback) {
|
UserEmail.confirm = function(code, callback) {
|
||||||
db.getObject('confirm:' + code, function(err, confirmObj) {
|
db.getObject('confirm:' + code, function(err, confirmObj) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback({
|
return callback(new Error('[[error:parse-error]]'));
|
||||||
status:'error'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirmObj && confirmObj.uid && confirmObj.email) {
|
if (confirmObj && confirmObj.uid && confirmObj.email) {
|
||||||
user.setUserField(confirmObj.uid, 'email:confirmed', 1, function() {
|
async.series([
|
||||||
callback({
|
async.apply(user.setUserField, confirmObj.uid, 'email:confirmed', 1),
|
||||||
status: 'ok'
|
async.apply(db.delete, 'confirm:' + code)
|
||||||
});
|
], function(err) {
|
||||||
|
callback(err ? new Error('[[error:email-confirm-failed]]') : null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback({
|
callback(new Error('[[error:invalid-data]]'));
|
||||||
status: 'not_ok'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user