admin: Handle team password
This commit is contained in:
parent
ed69dc6ba4
commit
5eeb1a6297
11 changed files with 299 additions and 40 deletions
|
|
@ -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++; },
|
||||
|
|
|
|||
|
|
@ -34,6 +34,19 @@
|
|||
<input type="color" class="form-control form-control-sm" id="{{ field }}{{ member.id }}" ng-model="team[field]" ng-if="field == 'color'" color>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" ng-if="team.id">
|
||||
<label for="passwd" class="col-sm-2 col-form-label-sm">Mot de passe</label>
|
||||
<div class="col-sm-10">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control form-control-sm" id="passwd" ng-model="team.password">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-sm btn-outline-danger" type="button" ng-click="resetPasswd(team)">
|
||||
<span class="glyphicon glyphicon-random" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-right" ng-show="team.id">
|
||||
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-save" aria-hidden="true"></span> Save</button>
|
||||
<button type="button" class="btn btn-danger" ng-click="deleteTeam()"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</button>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<button type="button" ng-click="show('print')" class="float-right btn btn-sm btn-secondary mr-2"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Imprimer les équipes</button>
|
||||
<button type="button" ng-click="show('export')" class="float-right btn btn-sm btn-secondary mr-2"><span class="glyphicon glyphicon-export" aria-hidden="true"></span> Statistiques générales</button>
|
||||
<button type="button" ng-click="desactiveTeams()" class="float-right btn btn-sm btn-danger mr-2" title="Cliquer pour marquer les équipes sans certificat comme inactives (et ainsi éviter que ses fichiers ne soient générés)"><span class="glyphicon glyphicon-leaf" aria-hidden="true"></span> Désactiver les équipes inactives</button>
|
||||
<button type="button" ng-click="genDexCfg()" class="float-right btn btn-sm btn-success mr-2"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> DexIdP</button>
|
||||
</h2>
|
||||
|
||||
<p><input type="search" class="form-control" placeholder="Search" ng-model="query" ng-keypress="validateSearch($event)" autofocus></p>
|
||||
|
|
|
|||
Reference in a new issue