mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-25 14:59:30 +00:00
Improve JavaScript of SOGoRootPage module
This commit is contained in:
@@ -1,45 +1,23 @@
|
||||
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* JavaScript for SOGoContacts */
|
||||
/* JavaScript for SOGoRootPage */
|
||||
|
||||
'use strict';
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var SOGoRootPageApp = angular.module('SOGoRootPage', ['SOGoAuthentication']);
|
||||
angular.module('SOGo.RootPage', ['SOGo.Authentication'])
|
||||
|
||||
SOGoRootPageApp.controller('loginController', ['$scope', '$http', 'SOGoAuthentication', function($scope, $http, SOGoAuthentication) {
|
||||
$scope.warning = false;
|
||||
$scope.login = function($event) {
|
||||
//$event.stopPropagation();
|
||||
.controller('loginController', ['$scope', 'Authentication', function($scope, Authentication) {
|
||||
$scope.warning = false;
|
||||
|
||||
var username = $scope.username,
|
||||
password = $scope.password,
|
||||
domain = $scope.domain,
|
||||
language,
|
||||
rememberLogin = $scope.rememberLogin ? 1 : 0;
|
||||
|
||||
if ($scope.loginSuffix && !username.endsWith($scope.loginSuffix)) {
|
||||
username += loginSuffix;
|
||||
domain = false;
|
||||
}
|
||||
if ($scope.language && $scope.language != 'WONoSelectionString') {
|
||||
language = $scope.language;
|
||||
}
|
||||
|
||||
SOGoAuthentication.login(username, password, domain, language, rememberLogin)
|
||||
.then(function(url) {
|
||||
window.location.href = url;
|
||||
}, function(msg) {
|
||||
$scope.warning = msg;
|
||||
});
|
||||
// $http({
|
||||
// method: 'POST',
|
||||
// url: 'http://debian.inverse.ca/SOGo/connect',
|
||||
// params: postData})
|
||||
// .success(function(data, status, headers, config) {
|
||||
// alert('success: ' + status);
|
||||
// }).error(function(data, status, headers, config) {
|
||||
// alert('error: ' + status);
|
||||
// });
|
||||
return false;
|
||||
};
|
||||
}]);
|
||||
$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;
|
||||
};
|
||||
}]);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user