mirror of https://github.com/portainer/portainer
fix(authentication): do not use $sanitize with LDAP authentication (#1136)
parent
1a28e1091c
commit
35dd3916dd
|
@ -1,6 +1,6 @@
|
||||||
angular.module('auth', [])
|
angular.module('auth', [])
|
||||||
.controller('AuthenticationController', ['$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) {
|
function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Authentication, Users, EndpointService, StateManager, EndpointProvider, Notifications, SettingsService) {
|
||||||
|
|
||||||
$scope.authData = {
|
$scope.authData = {
|
||||||
username: 'admin',
|
username: 'admin',
|
||||||
|
@ -78,9 +78,19 @@ function ($scope, $state, $stateParams, $window, $timeout, $sanitize, Authentica
|
||||||
|
|
||||||
$scope.authenticateUser = function() {
|
$scope.authenticateUser = function() {
|
||||||
$scope.authenticationError = false;
|
$scope.authenticationError = false;
|
||||||
var username = $sanitize($scope.authData.username);
|
|
||||||
var password = $sanitize($scope.authData.password);
|
SettingsService.publicSettings()
|
||||||
Authentication.login(username, password)
|
.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) {
|
.then(function success(data) {
|
||||||
return EndpointService.endpoints();
|
return EndpointService.endpoints();
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue