admin: Handle team password

This commit is contained in:
nemunaire 2021-09-09 11:20:45 +02:00
commit 5eeb1a6297
11 changed files with 299 additions and 40 deletions

View file

@ -1961,6 +1961,17 @@ angular.module("FICApp")
}
};
$scope.genDexCfg = function() {
$http.post("api/dex.yaml").then(function() {
$http.post("api/dex-password.tpl").then(function() {
$scope.addToast('success', 'Dex config refreshed.', "Don't forget to reload/reboot frontend host.");
}, function(response) {
$scope.addToast('danger', 'An error occurs when generating dex password tpl:', response.data.errmsg);
});
}, function(response) {
$scope.addToast('danger', 'An error occurs when generating dex config:', response.data.errmsg);
});
}
$scope.desactiveTeams = function() {
$http.post("api/disableinactiveteams").then(function() {
$scope.teams = Team.query();
@ -1993,7 +2004,7 @@ angular.module("FICApp")
}
}
})
.controller("TeamController", function($scope, $rootScope, $location, Team, TeamMember, $routeParams) {
.controller("TeamController", function($scope, $rootScope, $location, Team, TeamMember, $routeParams, $http) {
if ($scope.team && $scope.team.id)
$routeParams.teamId = $scope.team.id;
$scope.team = Team.get({ teamId: $routeParams.teamId });
@ -2010,6 +2021,14 @@ angular.module("FICApp")
});
}
}
$scope.resetPasswd = function(team) {
$http({
url: "api/password",
method: "POST"
}).then(function(response) {
team.password = response.data.password;
});
}
$scope.deleteTeam = function() {
backName = this.team.name;
this.team.$remove(function() { $scope.addToast('success', 'Team ' + backName + ' successfully removed.'); $location.url("/teams/"); $rootScope.staticFilesNeedUpdate++; },