mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
Add status invited-pending for users
no issue - added status invited-pending for invited users where sending the invitation email failed - removed console.log() from authentication.js
This commit is contained in:
parent
707d0039cc
commit
db5e02da2b
@ -198,8 +198,6 @@ authentication = {
|
||||
}).then(function () {
|
||||
return when.resolve({ users: [setupUser]});
|
||||
}).otherwise(function (error) {
|
||||
console.log('error');
|
||||
console.log(error);
|
||||
return when.reject(new errors.UnauthorizedError(error.message));
|
||||
});
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ users = {
|
||||
return dataProvider.User.add(newUser, options);
|
||||
} else {
|
||||
// only invitations for already invited users are resent
|
||||
if (foundUser.toJSON().status === 'invited') {
|
||||
if (foundUser.get('status') === 'invited' || foundUser.get('status') === 'invited-pending') {
|
||||
return foundUser;
|
||||
} else {
|
||||
return when.reject(new errors.BadRequestError('User is already registered.'));
|
||||
@ -192,12 +192,21 @@ users = {
|
||||
options: {}
|
||||
}]
|
||||
};
|
||||
return mail.send(payload);
|
||||
return mail.send(payload).then(function () {
|
||||
// If status was invited-pending and sending the invitation succeeded, set status to invited.
|
||||
if (user.status === 'invited-pending') {
|
||||
return dataProvider.User.edit({status: 'invited'}, {id: user.id});
|
||||
}
|
||||
});
|
||||
}).then(function () {
|
||||
return when.resolve({users: [user]});
|
||||
}).otherwise(function (error) {
|
||||
if (error && error.type === 'EmailError') {
|
||||
error.message = 'Error sending email: ' + error.message + ' Please check your email settings and resend the invitation.';
|
||||
// If sending the invitation failed, set status to invited-pending
|
||||
return dataProvider.User.edit({status: 'invited-pending'}, {id: user.id}).then(function () {
|
||||
return when.reject(error);
|
||||
});
|
||||
}
|
||||
return when.reject(error);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user