diff options
Diffstat (limited to 'plugins/CoreAdminHome/angularjs/smtp/mail-smtp.controller.js')
-rw-r--r-- | plugins/CoreAdminHome/angularjs/smtp/mail-smtp.controller.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/plugins/CoreAdminHome/angularjs/smtp/mail-smtp.controller.js b/plugins/CoreAdminHome/angularjs/smtp/mail-smtp.controller.js new file mode 100644 index 0000000000..1ef0ce0510 --- /dev/null +++ b/plugins/CoreAdminHome/angularjs/smtp/mail-smtp.controller.js @@ -0,0 +1,50 @@ +/*! + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +/** + * Controller to save mail smtp settings + */ +(function () { + angular.module('piwikApp').controller('MailSmtpController', MailSmtpController); + + MailSmtpController.$inject = ['$scope', 'piwikApi']; + + function MailSmtpController($scope, piwikApi) { + + var self = this; + this.isLoading = false; + + this.save = function () { + + this.isLoading = true; + + piwikApi.withTokenInUrl(); + piwikApi.post({module: 'CoreAdminHome', action: 'setMailSettings'}, { + mailUseSmtp: this.enabled ? '1' : '0', + mailPort: this.mailPort, + mailHost: this.mailHost, + mailType: this.mailType, + mailUsername: this.mailUsername, + mailPassword: this.mailPassword, + mailEncryption: this.mailEncryption, + }).then(function (success) { + + self.isLoading = false; + + var UI = require('piwik/UI'); + var notification = new UI.Notification(); + notification.show(_pk_translate('CoreAdminHome_SettingsSaveSuccess'), { + id: 'generalSettings', context: 'success' + }); + notification.scrollToNotification(); + + }, function () { + self.isLoading = false; + }); + }; + } +})();
\ No newline at end of file |