2014-09-24 22:06:12 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2014-08-06 21:26:52 +02:00
|
|
|
/* JavaScript for SOGoRootPage */
|
2014-06-19 21:50:29 +02:00
|
|
|
|
2014-08-06 21:26:52 +02:00
|
|
|
(function() {
|
2014-09-24 22:06:12 +02:00
|
|
|
'use strict';
|
2014-06-19 21:50:29 +02:00
|
|
|
|
2015-02-06 21:35:51 +01:00
|
|
|
angular.module('SOGo.MainUI', ['SOGo.Authentication', 'SOGo.UI'])
|
2014-06-19 21:50:29 +02:00
|
|
|
|
2015-02-13 15:14:10 +01:00
|
|
|
.controller('loginController', ['$scope', '$mdDialog', 'Authentication', function($scope, $mdDialog, Authentication) {
|
2014-09-24 22:06:12 +02:00
|
|
|
$scope.warning = false;
|
2015-02-13 20:30:24 +01:00
|
|
|
$scope.creds = { username: cookieUsername, password: null };
|
2014-09-24 22:06:12 +02:00
|
|
|
$scope.login = function(creds) {
|
2014-06-19 21:50:29 +02:00
|
|
|
$scope.warning = false;
|
2014-09-24 22:06:12 +02:00
|
|
|
Authentication.login(creds)
|
|
|
|
.then(function(url) {
|
|
|
|
window.location.href = url;
|
|
|
|
}, function(msg) {
|
|
|
|
$scope.warning = msg.error;
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
};
|
2015-02-13 15:14:10 +01:00
|
|
|
$scope.showAbout = function() {
|
|
|
|
var alert;
|
|
|
|
alert = $mdDialog.alert({
|
|
|
|
title: 'About SOGo',
|
|
|
|
content: 'This is SOGo v3!',
|
|
|
|
ok: 'OK'
|
|
|
|
});
|
|
|
|
$mdDialog
|
|
|
|
.show( alert )
|
|
|
|
.finally(function() {
|
|
|
|
alert = undefined;
|
|
|
|
});
|
|
|
|
};
|
2014-08-06 21:26:52 +02:00
|
|
|
}]);
|
|
|
|
})();
|