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

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;
});