token-validator: update to handle custom domains

This commit is contained in:
nemunaire 2021-03-05 14:52:14 +01:00
commit 5a4650f70e
4 changed files with 307 additions and 15 deletions

View file

@ -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,