fix(authentication): do not use $sanitize with LDAP authentication (#1136)

pull/1134/merge
Anthony Lapenna 2017-08-22 16:36:12 +02:00 committed by GitHub
parent 1a28e1091c
commit 35dd3916dd
1 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,6 @@
angular.module('auth', [])
.controller('AuthenticationController', ['$scope', '$state', '$stateParams', '$window', '$timeout', '$sanitize', 'Authentication', 'Users', 'EndpointService', 'StateManager', 'EndpointProvider', 'Notifications',
function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Authentication, Users, EndpointService, StateManager, EndpointProvider, Notifications) {
.controller('AuthenticationController', ['$scope', '$state', '$stateParams', '$window', '$timeout', '$sanitize', 'Authentication', 'Users', 'EndpointService', 'StateManager', 'EndpointProvider', 'Notifications', 'SettingsService',
function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Authentication, Users, EndpointService, StateManager, EndpointProvider, Notifications, SettingsService) {
$scope.authData = {
username: 'admin',
@ -78,9 +78,19 @@ function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Authentica
$scope.authenticateUser = function() {
$scope.authenticationError = false;
var username = $sanitize($scope.authData.username);
var password = $sanitize($scope.authData.password);
Authentication.login(username, password)
SettingsService.publicSettings()
.then(function success(data) {
var settings = data;
var username = $scope.authData.username;
var password = $scope.authData.password;
if (settings.AuthenticationMethod === 1) {
username = $sanitize($scope.authData.username);
password = $sanitize($scope.authData.password);
}
return Authentication.login(username, password);
})
.then(function success(data) {
return EndpointService.endpoints();
})