2014-06-19 21:50:29 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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() {
|
|
|
|
'use strict';
|
2014-06-19 21:50:29 +02:00
|
|
|
|
2014-09-05 21:23:35 +02:00
|
|
|
angular.module('SOGo.MainUI', ['SOGo.Authentication'])
|
2014-06-19 21:50:29 +02:00
|
|
|
|
2014-08-06 21:26:52 +02:00
|
|
|
.controller('loginController', ['$scope', 'Authentication', function($scope, Authentication) {
|
2014-06-19 21:50:29 +02:00
|
|
|
$scope.warning = false;
|
2014-08-06 21:26:52 +02:00
|
|
|
$scope.creds = { 'username': null, 'password': null };
|
|
|
|
$scope.login = function(creds) {
|
|
|
|
$scope.warning = false;
|
|
|
|
Authentication.login(creds)
|
|
|
|
.then(function(url) {
|
|
|
|
window.location.href = url;
|
|
|
|
}, function(msg) {
|
|
|
|
$scope.warning = msg.error;
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
}]);
|
|
|
|
})();
|