Commit db20e4b1 authored by Dustri's avatar Dustri
Browse files

Hopefully add a password-meter.

parent 39c2f720
(function(){
var a = function(){
var a,b;
b = document.createElement("script");
b.src = "./js/zxcvbn.js";
b.type = "text/javascript";
b.async =! 0;
a = document.getElementsByTagName("script")[0];
return a.parentNode.insertBefore(b,a)
};
if (window.attachEvent != null)
window.attachEvent("onload",a);
else
window.addEventListener("load",a,!1);
}).call(this);
function checkPassword(pwd) {
var output = document.getElementById('pmeter');
if (pwd != '') {
var ret = zxcvbn(pwd);
switch(ret.score) {
case 0:
output.innerHTML = 'SUPER-FAIBLE';
output.style.color = 'crimson';
break;
case 1:
output.innerHTML = 'FAIBLE';
output.style.color = 'red'
break;
case 2:
output.innerHTML = 'MEDIOCRE';
output.style.color = 'darkorange'
break;
case 3:
output.innerHTML = 'MOYENNE';
output.style.color = 'deeppink';
break;
case 4:
output.innerHTML = 'CORRECTE';
output.style.color = 'green';
break;
}
} else {
output.innerHTML = 'Champ vide';
output.style.color = 'black';
}
}
This diff is collapsed.
......@@ -28,7 +28,7 @@
*/
$topdir = "./";
require_once($topdir. "include/site.inc.php");
require_once($topdir . "include/site.inc.php");
require_once($topdir . "include/cts/special.inc.php");
require_once($topdir . "include/cts/sqltable.inc.php");
require_once($topdir . "include/entities/asso.inc.php");
......@@ -757,11 +757,13 @@ if ( $_REQUEST["page"] == "edit" && $can_edit )
}
elseif ( $_REQUEST["see"] == "passwd" )
{
$site->add_js("js/zxcvbn-async.js");
$frm = new form("changepassword","user.php?id_utilisateur=".$user->id,true,"POST","Changer de mot de passe");
$frm->add_hidden("action","changepassword");
$frm->add_password_field("ae2_password","Mot de passe","",true);
$frm->add_password_field("ae2_password2","Repetez le mot de passe","",true);
$frm->add_info("<div class='formrow'><div class='formlabel'>Qualité du mot de passe</div><div class='formfield' id='pmeter'>Champ vide</div></div>");
$frm->add_submit("save","Enregistrer");
$cts->add($frm,true);
......
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