Commit 92921e64 authored by Romain Therville's avatar Romain Therville 🐭

Quick fix for the error messages displayed during the AJAX calls

'add_user' and 'delete_purge_data'.

The code returned in AJAX is now evaluated as an INT instead of STRING.

issue#170
parent 96749b1b
......@@ -899,13 +899,13 @@ $(function () {
$.ajax({
url: val_url,
success: function(val, status, xhr) {
if (val == '1') {
if (val == 1) {
// user has already access to this project
$("#error_message").html($("#username_val").val() + ' has already access to this project!').show();
} else if (val == '4' || val == '3') {
} else if (val == 4 || val == 3) {
// username exists in database cannot create
$("#error_message").html('Cannot create this user account, ' + $("#username_val").val() + ' already exists!').show();
} else if (val == '5') {
} else if (val == 5) {
// email exists in database cannot create
$("#error_message").html('Cannot create this user account, ' + $("#email_val").val() + ' already exists!').show();
} else {
......@@ -1600,7 +1600,7 @@ function deletePRAHandler() {
location.reload();
} else {
$("#modal-label-tmpl").html("Error");
if (val== 1) {
if (val == 1) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>You don't have write permission on the specified directory.</div>");
} else if (val == 2) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi1-error'>An error occurred during login. Most likely you didn't enter the username or password correctly. Be certain that you enter them precisely as they are, including upper/lower case.</div>");
......
......@@ -664,7 +664,7 @@ $(function () {
success: function(val, status, xhr) {
// return code : 0 = ok, 1 = right error, 2 = authentication error, 3 = connexion error, 4 = error delete file , 5 error sql update
if (val == "0") {
if (val == 0) {
// Uncheck all checkboxes
$(".tx-nG6-wait").hide();
$("#modal-body-tmpl").html('Done !');
......@@ -672,15 +672,15 @@ $(function () {
refresh_purge_demand(purge_table["demand"]);
} else {
$("#modal-label-tmpl").html("Error");
if (val == "1") {
if (val == 1) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>You don't have write permission on the specified directory.</div>");
} else if (val == "2") {
} else if (val == 2) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred during login. Most likely you didn't enter the username or password correctly. Be certain that you enter them precisely as they are, including upper/lower case.</div>");
} else if (val == "3") {
} else if (val == 3) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred during server connection. Please contact the site administrator.</div>");
} else if (val == "4") {
} else if (val == 4) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred during file deletion check if user have unix rigth to remove files. Please contact the site administrator.</div>");
} else if (val == "5") {
} else if (val == 5) {
$("#modal-body-tmpl").html("<div class='tx-nG6-pi6-error'>An error occurred while updating in db. Please contact the site administrator.</div>");
}
$("#modal-foot-tmpl").html('<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"><i class="glyphicon glyphicon-remove"></i> Close</button>');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment