token-validator: update to handle custom domains
This commit is contained in:
parent
efab34d551
commit
5a4650f70e
4 changed files with 307 additions and 15 deletions
|
@ -381,6 +381,123 @@ angular.module("AdLinApp")
|
|||
});
|
||||
}
|
||||
|
||||
$scope.useMyAssociationD = function() {
|
||||
$scope.assoc = {
|
||||
"domain": $scope.adomains[0].domain,
|
||||
"cname": $scope.student.associated_domain?$scope.student.associated_domain:"",
|
||||
}
|
||||
$('#AssocMyDomainModal').modal('show');
|
||||
}
|
||||
|
||||
$scope.newMyDomainAssociationD = function(assoc) {
|
||||
$('#AssocMyDomainModal').modal('hide');
|
||||
$scope.pleaseWaitNewAssociation = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "api/adomains/",
|
||||
data: assoc,
|
||||
}).then(function(response) {
|
||||
$scope.updateAssociationD();
|
||||
$scope.checkLoginState();
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
$scope.addToast({
|
||||
variant: "success",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Votre domaine a bien été associé !",
|
||||
});
|
||||
}, function(response) {
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
$scope.addToast({
|
||||
variant: "danger",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Erreur durant l'association du domaine : " + response.data.errmsg,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.delMyDomainAssociationD = function(assoc) {
|
||||
$('#AssocMyDomainModal').modal('hide');
|
||||
$scope.pleaseWaitNewAssociation = true;
|
||||
assoc.cname = ''
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "api/adomains/",
|
||||
data: assoc,
|
||||
}).then(function(response) {
|
||||
$scope.updateAssociationD();
|
||||
$scope.checkLoginState();
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
$scope.addToast({
|
||||
variant: "success",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Votre domaine n'est plus pris en compte. Vous devez utiliser l'association qui vous a été attribuée sous adlin20xx.p0m.fr.",
|
||||
});
|
||||
}, function(response) {
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
$scope.addToast({
|
||||
variant: "danger",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Erreur durant l'association du domaine : " + response.data.errmsg,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.useMyDelegationD = function() {
|
||||
$scope.assoc = {
|
||||
"ns": $scope.student.delegated_domain?$scope.student.delegated_domain:"",
|
||||
}
|
||||
$('#DelegateMyDomainModal').modal('show');
|
||||
}
|
||||
|
||||
$scope.newMyDomainDelegationD = function(assoc) {
|
||||
$('#DelegateMyDomainModal').modal('hide');
|
||||
$scope.pleaseWaitNewDelegation = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "api/ddomains/",
|
||||
data: assoc,
|
||||
}).then(function(response) {
|
||||
$scope.checkLoginState();
|
||||
$scope.pleaseWaitNewDelegation = false;
|
||||
$scope.addToast({
|
||||
variant: "success",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Votre sous-domaine de délégation a bien été enregistré !",
|
||||
});
|
||||
}, function(response) {
|
||||
$scope.pleaseWaitNewDelegation = false;
|
||||
$scope.addToast({
|
||||
variant: "danger",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Erreur durant la délégation du domaine : " + response.data.errmsg,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.delMyDomainDelegatedD = function() {
|
||||
$scope.pleaseWaitNewDelegation = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "api/ddomains/",
|
||||
data: {},
|
||||
}).then(function(response) {
|
||||
$scope.checkLoginState();
|
||||
$scope.pleaseWaitNewDelegation = false;
|
||||
$scope.addToast({
|
||||
variant: "success",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Votre domaine n'est plus pris en compte. Vous devez utiliser la délégation qui vous a été attribuée sous srs.p0m.fr.",
|
||||
});
|
||||
}, function(response) {
|
||||
$scope.pleaseWaitNewDelegation = false;
|
||||
$scope.addToast({
|
||||
variant: "danger",
|
||||
title: "Maatma Domain Names",
|
||||
msg: "Erreur durant la délégation du domaine : " + response.data.errmsg,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$scope.addNS = function(domain) {
|
||||
$scope.nsrr = {
|
||||
"domain": domain,
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
Noms de domaine
|
||||
</h2>
|
||||
|
||||
<h3>Association simple</h3>
|
||||
<h3>
|
||||
Association simple
|
||||
<span class="badge badge-pill badge-dark" title="Une association simple est un sous-domaine qui va vous être attribué, sans que vous ayez à gérer de serveur DNS. Ce domaine sera associé à une IP que vous pourrez changer par la suite. C'est la première étape, plus facile que la délégation.">?</span>
|
||||
</h3>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
|
@ -28,6 +31,9 @@
|
|||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="pleaseWaitNewAssociation"></span>
|
||||
Demander une nouvelle association
|
||||
</button>
|
||||
<button class="btn ml-2" ng-class="{'btn-secondary': !adomains || !adomains.length, 'btn-success': adomains && adomains.length}" ng-disabled="!adomains || !adomains.length" ng-click="useMyAssociationD()">
|
||||
Utiliser mon domaine
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
@ -35,7 +41,10 @@
|
|||
|
||||
<hr class="my-4">
|
||||
|
||||
<h3>Délégation</h3>
|
||||
<h3>
|
||||
Délégation
|
||||
<span class="badge badge-pill badge-dark" title="Une délégation va vous permettre de gérer vous-même votre domaine sur Internet. Nous vous offrons login.srs.p0m.fr, mais vous pouvez aussi choisir de créer la délégation sur votre domaine, si vous en possédez un. Rendez-vous ensuite sur votre serveur pour y installer un serveur de noms de domaine autoritaire tel que nsd, bind, knot ou encore powerDNS...">?</span>
|
||||
</h3>
|
||||
|
||||
<ul class="nav nav-tabs" id="ddomainTabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
|
@ -48,11 +57,17 @@
|
|||
<a class="nav-link" data-toggle="tab" data-target="#DNSSEC" role="tab" aria-controls="dnssec" aria-selected="false">DNSSEC</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div ng-if="!student.delegated_domain" class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="NS" role="tabpanel" aria-labelledby="ns-tab">
|
||||
|
||||
<div ng-repeat="domain in ddomains">
|
||||
<h4 class="text-muted">{{ domain }}</h4>
|
||||
<h4 class="text-muted">
|
||||
{{ domain }}
|
||||
<button class="btn btn-sm btn-info ml-2" ng-if="$first" ng-click="useMyDelegationD()">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="pleaseWaitNewDelegation"></span>
|
||||
Utiliser mon domaine
|
||||
</button>
|
||||
</h4>
|
||||
|
||||
<table class="table table-striped table-hover" ng-controller="NSDomainsController">
|
||||
<thead>
|
||||
|
@ -65,7 +80,7 @@
|
|||
<tr ng-repeat="rr in domainNS">
|
||||
<td><span ng-repeat="val in rr.values">{{ val }} </span></td>
|
||||
<td>
|
||||
<span class="badge badge-pill badge-secondary">Not implemented yet</span>
|
||||
<!--span class="badge badge-pill badge-secondary">Not implemented yet</span-->
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-warning" ng-click="updateNS(domain, rr)">Modifier</button>
|
||||
|
@ -180,7 +195,31 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="student.delegated_domain">
|
||||
<h4 class="text-muted">
|
||||
{{ student.delegated_domain }}
|
||||
<button class="btn btn-sm btn-danger ml-2" ng-if="student.delegated_domain" ng-click="delMyDomainDelegatedD()">
|
||||
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" ng-show="pleaseWaitNewDelegation"></span>
|
||||
Ne plus utiliser mon domaine
|
||||
</button>
|
||||
</h4>
|
||||
<p>
|
||||
Vous avez choisi d'utiliser votre propre domaine pour réaliser la délégation.
|
||||
</p>
|
||||
<p>
|
||||
L'interface de maatma ne vous est plus utile, car pour réaliser la délégation, vous devez passer par l'interface de votre bureau d'enregistrement.
|
||||
</p>
|
||||
<p>
|
||||
Pour rappel, voici les enregistrements à rajouter :
|
||||
</p>
|
||||
<pre>
|
||||
;; Delegation {{ student.delegated_domain }} to the given name server
|
||||
{{ student.delegated_domain }} 300 IN NS ns.{{ student.delegated_domain }}
|
||||
|
||||
;; GLUE record to serve along with the previous record
|
||||
ns.{{ student.delegated_domain }} 300 IN AAAA [your NS ip]
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="AssocModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
|
@ -224,6 +263,85 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="AssocMyDomainModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Utiliser mon domaine</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Si tu possèdes ton propre domaine, tu peux l'utiliser à la place du domaine qui t'es proposé ici !
|
||||
</p>
|
||||
<p>
|
||||
Pour cela, rien de plus simple. Choisis un sous-domaine de ton choix, dans ton domaine (par exemple <code>adlin.nemunai.re</code>) :
|
||||
</p>
|
||||
<form class="ml-2 mr-2">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="mysubdomain">Ton sous-domaine :</label>
|
||||
<input class="form-control" id="mysubdomain" ng-model="assoc.cname" autofocus>
|
||||
</div>
|
||||
</form>
|
||||
<p>
|
||||
Ensuite, dans ta zone DNS, ajoute un alias pointant vers le domaine sous <code>adlin20xx.p0m.fr</code> qui t'es proposé :
|
||||
</p>
|
||||
<pre>
|
||||
{{ assoc.cname }} 300 IN CNAME {{ assoc.domain }}
|
||||
</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" ng-disabled="!assoc.cname" ng-click="newMyDomainAssociationD(assoc)">Ok, c'est fait</button>
|
||||
<button type="button" class="btn btn-danger" ng-show="student.associated_domain" ng-click="delMyDomainAssociationD(assoc)">Supprimer l'association enregistrée</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="DelegateMyDomainModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Utiliser mon domaine comme délégation</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Tu peux utiliser ton propre domaine à la place du domaine qui t'es proposé ici !
|
||||
</p>
|
||||
<p>
|
||||
Commence par choisir un sous-domaine de ton choix (différent de l'association ci-dessus), dans ton domaine (par exemple <code>adlin.nemunai.re</code>) :
|
||||
</p>
|
||||
<form class="ml-2 mr-2">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="mysubdomaind">Ton sous-domaine :</label>
|
||||
<input class="form-control" id="mysubdomaind" ng-model="assoc.ns" autofocus>
|
||||
</div>
|
||||
</form>
|
||||
<p>
|
||||
Ensuite, configure ta zone DNS, pour réaliser la délégation. L'interface
|
||||
</p>
|
||||
<pre>
|
||||
;; Delegation {{ assoc.ns }} to the given name server
|
||||
{{ assoc.ns }} 300 IN NS ns.{{ assoc.ns }}
|
||||
|
||||
;; GLUE record to serve along with the previous record
|
||||
ns.{{ assoc.ns }} 300 IN AAAA [your NS ip]
|
||||
</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
|
||||
<button type="button" class="btn btn-primary" ng-disabled="!assoc.ns" ng-click="newMyDomainDelegationD(assoc)">Ok, c'est fait</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="NSModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
Reference in a new issue