2015-05-06 18:06:14 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* JavaScript for MainUI (SOGoRootPage) */
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
2015-08-07 17:04:04 +02:00
|
|
|
angular.module('SOGo.MainUI', ['SOGo.Common', 'SOGo.Authentication']);
|
2015-05-06 18:06:14 +02:00
|
|
|
|
2015-08-07 17:04:04 +02:00
|
|
|
/**
|
|
|
|
* @ngInject
|
|
|
|
*/
|
|
|
|
LoginController.$inject = ['$scope', 'Dialog', '$mdDialog', 'Authentication'];
|
|
|
|
function LoginController($scope, Dialog, $mdDialog, Authentication) {
|
|
|
|
var vm = this;
|
|
|
|
|
|
|
|
vm.creds = { username: cookieUsername, password: null };
|
|
|
|
vm.login = login;
|
|
|
|
vm.showAbout = showAbout;
|
|
|
|
|
|
|
|
function login() {
|
|
|
|
Authentication.login(vm.creds)
|
2015-05-06 18:06:14 +02:00
|
|
|
.then(function(url) {
|
|
|
|
window.location.href = url;
|
|
|
|
}, function(msg) {
|
2015-08-07 17:04:04 +02:00
|
|
|
Dialog.alert(l('Authentication Failed'), msg.error);
|
2015-05-06 18:06:14 +02:00
|
|
|
});
|
|
|
|
return false;
|
2015-08-07 17:04:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function showAbout($event) {
|
2015-05-20 20:46:12 +02:00
|
|
|
$mdDialog.show({
|
|
|
|
targetEvent: $event,
|
|
|
|
templateUrl: 'aboutBox.html',
|
2015-08-07 17:04:04 +02:00
|
|
|
controller: AboutDialogController,
|
|
|
|
controllerAs: 'about'
|
2015-05-06 18:06:14 +02:00
|
|
|
});
|
2015-08-07 17:04:04 +02:00
|
|
|
AboutDialogController.$inject = ['$mdDialog'];
|
|
|
|
function AboutDialogController($mdDialog) {
|
|
|
|
this.closeDialog = function() {
|
2015-05-20 20:46:12 +02:00
|
|
|
$mdDialog.hide();
|
|
|
|
};
|
|
|
|
}
|
2015-08-07 17:04:04 +02:00
|
|
|
}
|
2015-05-06 18:06:14 +02:00
|
|
|
}
|
2015-08-07 17:04:04 +02:00
|
|
|
|
|
|
|
angular
|
|
|
|
.module('SOGo.MainUI')
|
|
|
|
.controller('LoginController', LoginController);
|
2015-05-06 18:06:14 +02:00
|
|
|
})();
|