0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Error if user has already been invited

closes #3681
This commit is contained in:
Felix Rieseberg 2014-08-08 16:32:03 -07:00
parent d6b62501c0
commit 4269ca94fa

View file

@ -36,6 +36,16 @@ var InviteNewUserController = Ember.Controller.extend({
self.set('role', self.get('authorRole'));
self.send('closeModal');
this.store.find('user').then(function (result) {
var invitedUser = result.findBy('email', email);
if (invitedUser) {
if (invitedUser.get('status') === 'invited' || invitedUser.get('status') === 'invited-pending') {
self.notifications.showWarn('A user with that email address was already invited.');
} else {
self.notifications.showWarn('A user with that email address already exists.');
}
} else {
newUser = self.store.createRecord('user', {
email: email,
status: 'invited',
@ -56,6 +66,8 @@ var InviteNewUserController = Ember.Controller.extend({
newUser.deleteRecord();
self.notifications.showErrors(errors);
});
}
});
},
confirmReject: function () {