ADD avancement sur les trolls, partie d'administration terminé
[euphorik.git] / js / euphorik.js
index d040dc3..4b56fa3 100755 (executable)
@@ -642,8 +642,11 @@ Client.prototype.enregistrement = function(login, password)
       this.login = login
       this.password = password
       if(this.flush())
+      {
          this.setStatut(statutType.auth_registered)
-      return true
+         return true
+      }
+      return false
    }
    else\r
    {
@@ -675,7 +678,7 @@ Client.prototype.connexion = function(messageJson)
 \r
 Client.prototype.deconnexion = function()\r
 {
-   this.flush()
+   this.flush(true)
    this.delCookie()\r
    this.setStatut(statutType.deconnected) // deconnexion\r
    this.resetDonneesPersonnelles()\r
@@ -718,12 +721,14 @@ Client.prototype.chargerDonnees = function(data)
 Client.prototype.flush = function(async)
 {
    if (async == undefined)
-      async = true
+      async = false
       
    if (!this.authentifie())
       return false
 
    thisClient = this
+   var ok = true
+   
    ;;; dumpObj(this.getJSONProfile())
    jQuery.ajax(
       {
@@ -735,12 +740,17 @@ Client.prototype.flush = function(async)
          success:
             function(data)
             {
-               //thisClient.util.log(thisClient.util.serializer.serializeToString(data))   
+               ;;; dumpObj(data)
+               if (data["reply"] == "error")
+               {
+                  thisClient.dernierMessageErreur = data["error_message"]
+                  ok = false
+               }
             }
       }
    )
-   // TODO : retourner false si un problème est survenu lors de l'update du profile
-   return true
+   
+   return ok
 }
 
 Client.prototype.majMenu = function()
@@ -930,7 +940,7 @@ $(document).ready(
       initialiserListeStyles(client)
 
       // TODO : pourquoi $(document).unload ne fonctionne pas ?
-      $(window).unload(function(){client.flush(false)})
+      $(window).unload(function(){client.flush()})
       
       $("#menu .minichat").click(function(){ pages.afficherPage("minichat") })
       $("#menu .admin").click(function(){ pages.afficherPage("admin") })