Add alias error reporting

This commit is contained in:
Johannes Zellner
2018-04-01 20:31:16 +02:00
parent baba63889d
commit 158271de14
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -136,6 +136,7 @@
{{ user.username }}
</td>
<td>
<p ng-show="user.aliases !== user.orig.aliases && user.error" class="text-danger"><b>{{ user.error }}</b></p>
<tag-input ng-show="user.mailboxEnabled" placeholder="add alias" taglist="user.aliases" name="aliases"></tag-input>
</td>
<td class="text-right no-wrap">
+7 -1
View File
@@ -90,13 +90,19 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
submit: function (user) {
user.busy = true;
user.error ='';
var aliases = user.aliases.split(',').map(function (a) { return a.trim(); }).filter(function (a) { return !!a; });
function done(error) {
user.busy = false;
if (error) {
if (error && error.statusCode === 409) {
var alias = error.message.match(RegExp('\'(.*)-' + $scope.selectedDomain.domain + '\''))[1];
user.error = alias + '@' + $scope.selectedDomain.domain + ' already exists';
console.log('clearly hit', user.error)
return;
} else if (error) {
console.error('Unable to configure mailbox.', error);
return;
}