Verify relay credentials

part of #188
This commit is contained in:
Girish Ramakrishnan
2017-06-27 15:44:36 -05:00
parent 5886671fba
commit 00990b6837
3 changed files with 32 additions and 9 deletions
+5 -2
View File
@@ -126,8 +126,11 @@
</div>
</div>
<div class="row">
<div class="col-md-12">
<button class="btn btn-primary pull-right" ng-click="mailRelay.submit()" ng-disabled="!mailRelayForm.$dirty || mailRelayForm.$invalid || mailRelay.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="mailRelay.busy"></i> Save</button>
<div class="col-md-2">
<button class="btn btn-primary" ng-click="mailRelay.submit()" ng-disabled="!mailRelayForm.$dirty || mailRelayForm.$invalid || mailRelay.busy"><i class="fa fa-circle-o-notch fa-spin" ng-show="mailRelay.busy"></i> Save</button>
</div>
<div class="col-md-10">
<span class="has-error text-center" ng-show="mailRelay.error">{{ mailRelay.error }}</span>
</div>
</div>
</div>
+7 -2
View File
@@ -95,11 +95,13 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
];
$scope.mailRelay = {
error: {},
error: null,
busy: false,
preset: $scope.mailRelayPresets[0],
presetChanged: function () {
$scope.mailRelay.error = null;
$scope.mailRelay.relay.enabled = $scope.mailRelay.preset.enabled;
$scope.mailRelay.relay.presetId = $scope.mailRelay.preset.id;
$scope.mailRelay.relay.host = $scope.mailRelay.preset.host;
@@ -119,10 +121,13 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
},
submit: function () {
$scope.mailRelay.error = null;
$scope.mailRelay.busy = true;
Client.setMailRelay($scope.mailRelay.relay, function (error) {
if (error) console.error('Unable to set relay', error);
if (error) {
$scope.mailRelay.error = error.message;
}
$scope.mailRelay.busy = false;
});