',
- $.confirm({
- title: 'Authentification requise',
- content: content,
- backgroundDismiss: true,
- animation: 'top',
- closeAnimation: 'bottom',
- keyboardEnabled: true,
- confirm: function () {
- var password = this.$content.find('input').val();
- callback(password);
- },
- onOpen: function () {
- var that = this;
- var capslock = -1; // 1 -> caps on ; 0 -> caps off ; -1 or 2 -> unknown
- this.$content.find('input').on('keypress', function (e) {
- if (e.keyCode == 13)
- that.$confirmButton.click();
+ var content = getErrorsHtml(data["missing_perms"], is_error = false);
+ content += '
';
- var s = String.fromCharCode(e.which);
- if ((s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey) || //caps on, shift off
- (s.toUpperCase() !== s && s.toLowerCase() === s && e.shiftKey)) { //caps on, shift on
- capslock = 1;
- } else if ((s.toLowerCase() === s && s.toUpperCase() !== s && !e.shiftKey) || //caps off, shift off
- (s.toLowerCase() !== s && s.toUpperCase() === s && e.shiftKey)) { //caps off, shift on
- capslock = 0;
- }
- if (capslock == 1)
- $('.capslock .glyphicon').show();
- else if (capslock == 0)
- $('.capslock .glyphicon').hide();
- });
- // Capslock key is not detected by keypress
- this.$content.find('input').on('keydown', function (e) {
- if (e.which == 20) {
- capslock = 1 - capslock;
- }
- if (capslock == 1)
- $('.capslock .glyphicon').show();
- else if (capslock == 0)
- $('.capslock .glyphicon').hide();
- });
- },
- onClose: function () {
- if (focus_next)
- this._lastFocused = focus_next;
- }
+ $.confirm({
+ title: 'Authentification requise',
+ content: content,
+ backgroundDismiss: true,
+ animation: 'top',
+ closeAnimation: 'bottom',
+ keyboardEnabled: true,
+ confirm: function () {
+ var password = this.$content.find('input').val();
+ callback(password);
+ },
+ onOpen: function () {
+ var that = this;
+ var capslock = -1; // 1 -> caps on ; 0 -> caps off ; -1 or 2 -> unknown
+ this.$content.find('input').on('keypress', function (e) {
+ if (e.keyCode == 13)
+ that.$confirmButton.click();
- });
+ var s = String.fromCharCode(e.which);
+ if ((s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey) || //caps on, shift off
+ (s.toUpperCase() !== s && s.toLowerCase() === s && e.shiftKey)) { //caps on, shift on
+ capslock = 1;
+ } else if ((s.toLowerCase() === s && s.toUpperCase() !== s && !e.shiftKey) || //caps off, shift off
+ (s.toLowerCase() !== s && s.toUpperCase() === s && e.shiftKey)) { //caps off, shift on
+ capslock = 0;
+ }
+ if (capslock == 1)
+ $('.capslock .glyphicon').show();
+ else if (capslock == 0)
+ $('.capslock .glyphicon').hide();
+ });
+ // Capslock key is not detected by keypress
+ this.$content.find('input').on('keydown', function (e) {
+ if (e.which == 20) {
+ capslock = 1 - capslock;
+ }
+ if (capslock == 1)
+ $('.capslock .glyphicon').show();
+ else if (capslock == 0)
+ $('.capslock .glyphicon').hide();
+ });
+ },
+ onClose: function () {
+ if (focus_next)
+ this._lastFocused = focus_next;
+ }
+
+ });
}
-function displayErrors(html) {
+function displayErrors(data) {
+ const content = getErrorsHtml(data["errors"], is_error = true);
$.alert({
title: 'Erreurs',
- content: html,
+ content: content,
backgroundDismiss: true,
animation: 'top',
closeAnimation: 'bottom',
diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html
index ece98578..8259d694 100644
--- a/kfet/templates/kfet/kpsul.html
+++ b/kfet/templates/kfet/kpsul.html
@@ -376,10 +376,10 @@ $(document).ready(function() {
requestAuth(data, performOperations, articleSelect);
break;
case 400:
- if ('need_comment' in data['errors']) {
+ if ('need_comment' in data) {
askComment(performOperations);
} else {
- displayErrors(getErrorsHtml(data));
+ displayErrors(data);
}
break;
}
@@ -1074,7 +1074,7 @@ $(document).ready(function() {
}, triInput);
break;
case 400:
- askAddcost(getErrorsHtml(data));
+ askAddcost(getErrorsHtml(data["errors"], is_error=true));
break;
}
});
diff --git a/kfet/templates/kfet/transfers_create.html b/kfet/templates/kfet/transfers_create.html
index a4a1a450..fc429d97 100644
--- a/kfet/templates/kfet/transfers_create.html
+++ b/kfet/templates/kfet/transfers_create.html
@@ -72,7 +72,7 @@ $(document).ready(function () {
var $next = $form.next('.transfer_form').find('.from_acc input');
}
var $input_id = $input.next('input');
- if (isValidTrigramme(trigramme)) {
+ if (trigramme.is_valid_trigramme()) {
getAccountData(trigramme, function(data) {
$input_id.val(data.id);
$data.text(data.name);
@@ -122,7 +122,7 @@ $(document).ready(function () {
requestAuth(data, performTransfers);
break;
case 400:
- displayErrors(getErrorsHtml(data));
+ displayErrors(data);
break;
}
});