IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AJAX Discussion :

[AJAX] Niveau de sécurité du mot de passe


Sujet :

AJAX

  1. #1
    Membre éclairé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2002
    Messages
    744
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2002
    Messages : 744
    Par défaut [AJAX] Niveau de sécurité du mot de passe
    bonjour,
    j'ai essayé de copier le script de Niveau de sécurité du mot de passe de gmail quand on modifie notre mot de passe.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
     
    <script type="text/javascript" src="mps.js"></script>
      <script type="text/javascript">
    <!--
      var myxmlhttp;
      var isBrowserCompatible;
      ratingMsgs = new Array(6);
      ratingMsgColors = new Array(6);
      barColors = new Array(6);
     
      ratingMsgs[0] = "Trop court";
      ratingMsgs[1] = "Faible";
      ratingMsgs[2] = "Correct";
      ratingMsgs[3] = "Bon";
      ratingMsgs[4] = "Élevé(e)";
      ratingMsgs[5] = "Non évalué"; 
     
      ratingMsgColors[0] = "#676767";
      ratingMsgColors[1] = "#aa0033";
      ratingMsgColors[2] = "#f5ac00";
      ratingMsgColors[3] = "#6699cc";
      ratingMsgColors[4] = "#008000";
      ratingMsgColors[5] = "#676767";
     
      barColors[0] = "#dddddd";
      barColors[1] = "#aa0033";
      barColors[2] = "#ffcc33";
      barColors[3] = "#6699cc";
      barColors[4] = "#008000";
      barColors[5] = "#676767";
    function CreateRatePasswdReq(formKey) {
        if (!isBrowserCompatible) {
          return;
        }
     
    	//var passwd = document.forms[formKey].Passwd.value;
     
    	var passwd = document.getElementById("Passwd").value;  
    	var min_passwd_len = 3;
        var passwdKey = "Passwd";
     
        if (passwd.length < min_passwd_len) {
          if (passwd.length > 0) { 
      DrawBar(0);
      } else {
      resetBar();
      }
      } else {
      passwd = escape(passwd);
      var params = passwdKey + "=" + passwd;
      myxmlhttp = CreateXmlHttpReq(RatePasswdXmlHttpHandler); 
      XmlHttpPOST(myxmlhttp, "verifniveau.php", params);
      }
      }
     
      function RatePasswdXmlHttpHandler() {
      if (myxmlhttp.readyState != 4) {
      return;
      }
      rating = parseInt(myxmlhttp.responseText);
      DrawBar(rating);
      }
    function DrawBar(rating) {
      var posbar = getElement('posBar');
      var negbar = getElement('negBar');
      var passwdRating = getElement('passwdRating');
      var barLength = getElement('passwdBarDiv').width;
      if (rating >= 0 && rating <= 4) {  
          posbar.style.width = barLength / 4 * rating;
          negbar.style.width = barLength / 4 * (4 - rating);
        } else {
          posbar.style.width = 0;
          negbar.style.width = barLength;
          rating = 5; 
        }
        posbar.style.background = barColors[rating];
        passwdRating.innerHTML = "<font color='" + ratingMsgColors[rating] +
                                 "'>" + ratingMsgs[rating] + "</font>";
      }
    function resetBar() {
      var posbar = getElement('posBar');
      var negbar = getElement('negBar');
      var passwdRating = getElement('passwdRating');
      var barLength = getElement('passwdBar').width;
      posbar.style.width = "0px";
      negbar.style.width = barLength + "px";
      passwdRating.innerHTML = "";
      }
      var agt = navigator.userAgent.toLowerCase();
      var is_op = (agt.indexOf("opera") != -1);
      var is_ie = (agt.indexOf("msie") != -1) && document.all && !is_op;
      var is_mac = (agt.indexOf("mac") != -1);
      var is_gk = (agt.indexOf("gecko") != -1);
      var is_sf = (agt.indexOf("safari") != -1);
      function gff(str, pfx) {
      var i = str.indexOf(pfx);
      if (i != -1) {
      var v = parseFloat(str.substring(i + pfx.length));
      if (!isNaN(v)) {
      return v;
      }
      }
      return null;
      }
    function Compatible() {
      if (is_ie && !is_op && !is_mac) {
      var v = gff(agt, "msie ");
      if (v != null) {
      return (v >= 6.0);
      }
      }
      if (is_gk && !is_sf) {
      var v = gff(agt, "rv:");
      if (v != null) {
      return (v >= 1.4);
      } else {
      v = gff(agt, "galeon/");
      if (v != null) {
      return (v >= 1.3);
      }
      }
      }
      if (is_sf) {
      var v = gff(agt, "applewebkit/");
      if (v != null) {
      return (v >= 124);
      }
      }
      return false;
      }
      myxmlhttp = CreateXmlHttpReq(RatePasswdXmlHttpHandler);
      isBrowserCompatible = Compatible() && myxmlhttp;
    </script>
    le fichier mps.js
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
     
    //------------------------------------------------------------------------
    // This file depends on: 
    // http://gmail.google.com/gmail?view=page&name=browser
    //------------------------------------------------------------------------
     
    //------------------------------------------------------------------------
    // Some browser detection logic. 
    // Once http://gmail.google.com/gmail?view=page&name=browser has these 
    // variables as *global* these definitions can be deleted. 
    //------------------------------------------------------------------------
    var agt = navigator.userAgent.toLowerCase();
    var is_op = (agt.indexOf("opera") != -1);
    var is_ie = (agt.indexOf("msie") != -1) && document.all && !is_op;
    var is_ie5 = (agt.indexOf("msie 5") != -1) && document.all && !is_op;
     
    //------------------------------------------------------------------------
    // Communication with server
    //------------------------------------------------------------------------
     
    function CreateXmlHttpReq(handler) {
      var xmlhttp = null;
      if (is_ie) {
        // Guaranteed to be ie5 or ie6
        var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";
     
        try {
          xmlhttp = new ActiveXObject(control);
          xmlhttp.onreadystatechange = handler;
        } catch (ex) {
          // TODO: better help message
          alert("You need to enable active scripting and activeX controls");  
        }
     
      } else {
     
        // Mozilla
        xmlhttp = new XMLHttpRequest();
        xmlhttp.onload = handler;
        xmlhttp.onerror = handler;
     
      }
     
      return xmlhttp;
    }
     
    // XMLHttp send POST request
    function XmlHttpPOST(xmlhttp, url, data) {
      try {
        xmlhttp.open("POST", url, true);
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        xmlhttp.send(data);
     
      } catch (ex) {
        // do nothing
      }
    }
     
    // XMLHttp send GEt request
    function XmlHttpGET(xmlhttp, url) {
      try {
        xmlhttp.open("GET", url, true);	
        xmlhttp.send(null);
     
      } catch (ex) {
        // do nothing
      }
    }
    Tout est parfait sauf que je ne sais pas quoi mettre dans le fichier verifniveau.php, dans la ligne qui contient ce code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    xmlhttp.open("POST", url, true);

  2. #2
    Membre éprouvé Avatar de oceane751
    Profil pro
    Intégrateur Web
    Inscrit en
    Novembre 2004
    Messages
    1 280
    Détails du profil
    Informations personnelles :
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Intégrateur Web

    Informations forums :
    Inscription : Novembre 2004
    Messages : 1 280
    Par défaut
    peut être à y mettre un fichier qui grâce à lui tu vas pouvoir récupérer des données!

    par exemple, un fichier php qui contiendra une requête sql..

  3. #3
    Membre éclairé
    Homme Profil pro
    Développeur Web
    Inscrit en
    Mai 2002
    Messages
    744
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2002
    Messages : 744
    Par défaut
    merci,
    c'est ce que j'ai fait un fichier php traité par une requête ajax
    encore merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. niveau de sécurité du mot de passe
    Par redoran dans le forum Débuter
    Réponses: 17
    Dernier message: 25/08/2010, 11h18
  2. Niveau de sécurité du mot de passe
    Par vinze54 dans le forum Spring Web
    Réponses: 2
    Dernier message: 21/03/2009, 05h28
  3. Réponses: 12
    Dernier message: 08/09/2006, 15h58
  4. [Sécurité] Codage mot de passe md5
    Par tilou dans le forum Langage
    Réponses: 6
    Dernier message: 12/04/2006, 11h55
  5. [WebForms][2.0] Règle de sécurité des mots de passe
    Par oli_carbo dans le forum Général Dotnet
    Réponses: 5
    Dernier message: 20/03/2006, 12h07

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo