Permalink
Browse files

version 1.5, major changes

  • Loading branch information...
juliendangers committed Apr 25, 2012
1 parent 6a6394f commit 40550bcea29f4facbea81386705a45b4616de784
@@ -1,7 +0,0 @@
-<?php
-
-include(dirname(dirname(dirname(__FILE__)))."/engine/start.php");
- header("Content-type: text/javascript");
- header("Pragma: public");
- header("Cache-Control: public");
-?>(function(A){A.extend(A.fn,{pstrength:function(B){var B=A.extend({verdects:["<?php echo elgg_echo('Too weak').'","'.elgg_echo('Weak').'","'.elgg_echo('Medium').'","'.elgg_echo('Strong').'","'.elgg_echo('Too strong').'"'; ?>],colors:["#f00","#c06","#f60","#3c0","#3f0"],scores:[10,15,30,40],common:["password","sex","god","123456","123","liverpool","letmein","qwerty","monkey","azerty","motdepasse"],minchar:<?php echo get_plugin_setting("minlength", "password_change"); ?>},B);return this.each(function(){var C=A(this).attr("id");A(this).after("<div class=\"pstrength-minchar\" id=\""+C+"_minchar\"><?php echo elgg_echo("passwordchange:minlength"); ?>: "+B.minchar+"</div>");A(this).after("<div class=\"pstrength-info\" id=\""+C+"_text\"></div>");A(this).after("<div class=\"pstrength-bar\" id=\""+C+"_bar\" style=\"border: 1px solid white; font-size: 1px; height: 5px; width: 0px;\"></div>");A(this).keyup(function(){A.fn.runPassword(A(this).val(),C,B)})})},runPassword:function(D,F,C){nPerc=A.fn.checkPassword(D,C);var B="#"+F+"_bar";var E="#"+F+"_text";if(nPerc==-200){strColor="#f00";strText="<?php echo elgg_echo('passwordchange:unsafe');?>";A(B).css({width:"0%"})}else{if(nPerc<0&&nPerc>-199){strColor="#ccc";strText="<?php echo elgg_echo('Too short');?>";A(B).css({width:"5%"})}else{if(nPerc<=C.scores[0]){strColor=C.colors[0];strText=C.verdects[0];A(B).css({width:"10%"})}else{if(nPerc>C.scores[0]&&nPerc<=C.scores[1]){strColor=C.colors[1];strText=C.verdects[1];A(B).css({width:"25%"})}else{if(nPerc>C.scores[1]&&nPerc<=C.scores[2]){strColor=C.colors[2];strText=C.verdects[2];A(B).css({width:"50%"})}else{if(nPerc>C.scores[2]&&nPerc<=C.scores[3]){strColor=C.colors[3];strText=C.verdects[3];A(B).css({width:"75%"})}else{strColor=C.colors[4];strText=C.verdects[4];A(B).css({width:"92%"})}}}}}}A(B).css({backgroundColor:strColor});A(E).html("<span style='color: "+strColor+";'>"+strText+"</span>")},checkPassword:function(C,B){var F=0;var E=B.verdects[0];if(C.length<B.minchar){F=(F-100)}else{if(C.length>=B.minchar&&C.length<=(B.minchar+2)){F=(F+6)}else{if(C.length>=(B.minchar+3)&&C.length<=(B.minchar+4)){F=(F+12)}else{if(C.length>=(B.minchar+5)){F=(F+18)}}}}if(C.match(/[a-z]/)){F=(F+1)}if(C.match(/[A-Z]/)){F=(F+5)}if(C.match(/\d+/)){F=(F+5)}if(C.match(/(.*[0-9].*[0-9].*[0-9])/)){F=(F+7)}if(C.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){F=(F+5)}if(C.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){F=(F+7)}if(C.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){F=(F+2)}if(C.match(/([a-zA-Z])/)&&C.match(/([0-9])/)){F=(F+3)}if(C.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){F=(F+3)}for(var D=0;D<B.common.length;D++){if(C.toLowerCase()==B.common[D]){F=-200}}return F}})})(jQuery)
@@ -1,28 +0,0 @@
-<?php
- /**
- * Password change language pack
- *
- */
-
- $french = array(
-
- 'passwordchanger:renew' => "La durée de validité de votre mot de passe est expirée, vous devez le modifier avant de pouvoir continuer",
- 'passwordchanger:length'=>"Longueur minimale du mot de passe",
- 'passwordchanger:dayslong'=>"Durée de validité du mot de passe (en jours)",
- 'passwordchanger:strengh'=>"Activer la vérification de la force du mot de passe",
- 'passwordchanger:common' => "Votre mot de passe est trop faible! Veuillez le modifier.",
- 'passwordchanger:tooweak' => "Mot de passe trop faible. Vous pouvez ajouter des majuscules et/ou des chiffres!",
- 'Too short' => "Trop court",
- 'Too weak' =>"Très faible",
- 'Weak'=>"Faible",
- 'Medium'=>"Moyen",
- 'Strong'=>"Fort",
- 'Too strong'=>"Très fort",
- 'passwordchanger:minlength'=>"Nombre minimum de charactères",
- 'passwordchange:same' => "Vous devez créer un nouveau mot de passe",
- 'passwordchanger:unsafe'=>"Mot de passe interdit",
- 'passwordchange:start'=>"Utiliser la date d'inscription comme date de départ (par défaut la date de connexion après l'activation sera utilisée)? Tous les utilisateurs s'étant inscrit avant la période choisie devront redéfinir leur mot de passe lors de leur prochaine connexion."
- );
-
- add_translation("fr",$french);
-?>
@@ -9,14 +9,8 @@
gatekeeper();
$minlength = 4;
-$enabled = true;
-
-if(is_plugin_enabled("password_change"))
- $enabled = true;
-if($enabled){
- $minlength = get_plugin_setting("minlength","password_change");
-}
+$minlength = get_plugin_setting("minlength","password_change");
$current_password = get_input('current_password');
$password = get_input('password');
@@ -45,22 +39,19 @@
if (strlen($password) >= $minlength) {
if ($password == $password2 && $current_password != $password) {
- if($enabled){
- if(get_plugin_setting("minCheck","password_change") == "yes"){
- $ret = checkPassword($password);
- if($ret == -200){
- register_error(elgg_echo('passwordchange:common'));
- forward($_SERVER['HTTP_REFERER']);
- } else if($ret < 16 ){
- register_error(elgg_echo('passwordchange:tooweak'));
- forward($_SERVER['HTTP_REFERER']);
- }
- }
+ if(get_plugin_setting("minCheck","password_change") == "yes"){
+ $ret = checkPassword($password);
+ if($ret == -200){
+ register_error(elgg_echo('passwordchange:common'));
+ forward($_SERVER['HTTP_REFERER']);
+ } else if($ret < 16 ){
+ register_error(elgg_echo('passwordchange:tooweak'));
+ forward($_SERVER['HTTP_REFERER']);
+ }
}
$user->salt = generate_random_cleartext_password(); // Reset the salt
$user->password = generate_user_password($user, $password);
- if($enabled)
- $user->lastPwdChange = time();
+ $user->lastPwdChange = time();
if ($user->save()) {
system_message(elgg_echo('user:password:success'));
} else {
@@ -0,0 +1,7 @@
+<?php
+
+include(dirname(dirname(dirname(__FILE__)))."/engine/start.php");
+ header("Content-type: text/javascript");
+ header("Pragma: public");
+ header("Cache-Control: public");
+?>(function(A){A.extend(A.fn,{pstrength:function(B){var B=A.extend({verdects:["<?php echo elgg_echo('Too weak').'","'.elgg_echo('Weak').'","'.elgg_echo('Medium').'","'.elgg_echo('Strong').'","'.elgg_echo('Too strong').'"'; ?>],colors:["#f00","#c06","#f60","#3c0","#3f0"],scores:[10,15,30,40],common:["password","sex","god","123456","123","liverpool","letmein","qwerty","monkey","azerty","motdepasse"],minchar:<?php if($min=get_plugin_setting("minlength", "password_change")) echo $min; else echo "6"; ?>},B);return this.each(function(){var C=A(this).attr("id");A(this).after("<div class=\"pstrength-minchar\" id=\""+C+"_minchar\"><?php echo elgg_echo("passwordchange:minlength"); ?>: "+B.minchar+"</div>");A(this).after("<div class=\"pstrength-info\" id=\""+C+"_text\"></div>");A(this).after("<div class=\"pstrength-bar\" id=\""+C+"_bar\" style=\"border: 1px solid white; font-size: 1px; height: 5px; width: 0px;\"></div>");A(this).keyup(function(){A.fn.runPassword(A(this).val(),C,B)})})},runPassword:function(D,F,C){nPerc=A.fn.checkPassword(D,C);var B="#"+F+"_bar";var E="#"+F+"_text";if(nPerc==-200){strColor="#f00";strText="<?php echo elgg_echo('passwordchange:unsafe');?>";A(B).css({width:"0%"})}else{if(nPerc<0&&nPerc>-199){strColor="#ccc";strText="<?php echo elgg_echo('Too short');?>";A(B).css({width:"5%"})}else{if(nPerc<=C.scores[0]){strColor=C.colors[0];strText=C.verdects[0];A(B).css({width:"10%"})}else{if(nPerc>C.scores[0]&&nPerc<=C.scores[1]){strColor=C.colors[1];strText=C.verdects[1];A(B).css({width:"25%"})}else{if(nPerc>C.scores[1]&&nPerc<=C.scores[2]){strColor=C.colors[2];strText=C.verdects[2];A(B).css({width:"50%"})}else{if(nPerc>C.scores[2]&&nPerc<=C.scores[3]){strColor=C.colors[3];strText=C.verdects[3];A(B).css({width:"75%"})}else{strColor=C.colors[4];strText=C.verdects[4];A(B).css({width:"92%"})}}}}}}A(B).css({backgroundColor:strColor});A(E).html("<span style='color: "+strColor+";'>"+strText+"</span>")},checkPassword:function(C,B){var F=0;var E=B.verdects[0];if(C.length<B.minchar){F=(F-100)}else{if(C.length>=B.minchar&&C.length<=(B.minchar+2)){F=(F+6)}else{if(C.length>=(B.minchar+3)&&C.length<=(B.minchar+4)){F=(F+12)}else{if(C.length>=(B.minchar+5)){F=(F+18)}}}}if(C.match(/[a-z]/)){F=(F+1)}if(C.match(/[A-Z]/)){F=(F+5)}if(C.match(/\d+/)){F=(F+5)}if(C.match(/(.*[0-9].*[0-9].*[0-9])/)){F=(F+7)}if(C.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)){F=(F+5)}if(C.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)){F=(F+7)}if(C.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)){F=(F+2)}if(C.match(/([a-zA-Z])/)&&C.match(/([0-9])/)){F=(F+3)}if(C.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)){F=(F+3)}for(var D=0;D<B.common.length;D++){if(C.toLowerCase()==B.common[D]){F=-200}}return F}})})(jQuery)
@@ -6,7 +6,7 @@
$english = array(
- 'passwordchanger:renew' => "Your password expired, You have to create a new one to continue",
+ 'passwordchange:renew' => "Your password expired, You have to create a new one to continue",
'passwordchange:length'=>"Minimum password length",
'passwordchange:dayslong'=>"Password validity (in days)",
'passwordchange:strengh'=>"Check password strength",
@@ -20,7 +20,7 @@
'Very strong'=>"Very strong",
'passwordchange:minlength'=>"Nombre minimum de charactères",
'passwordchange:same' => "Current password and new password must be different",
- 'passwordchanger:unsafe'=>"Unsafe password word",
+ 'passwordchange:unsafe'=>"Unsafe password word",
'passwordchange:start'=>"Set time_created as start date (default is next connection after the activation of the plugin)? Will force older users to change their password immediately."
);
@@ -0,0 +1,28 @@
+<?php
+ /**
+ * Password change language pack
+ *
+ */
+
+ $french = array(
+
+ 'passwordchange:renew' => "La durée de validité de votre mot de passe est expirée, vous devez le modifier avant de pouvoir continuer",
+ 'passwordchange:length'=>"Longueur minimale du mot de passe",
+ 'passwordchange:dayslong'=>"Durée de validité du mot de passe (en jours)",
+ 'passwordchange:strengh'=>"Activer la vérification de la force du mot de passe",
+ 'passwordchange:common' => "Votre mot de passe est trop faible! Veuillez le modifier.",
+ 'passwordchange:tooweak' => "Mot de passe trop faible. Vous pouvez ajouter des majuscules et/ou des chiffres!",
+ 'Too short' => "Trop court",
+ 'Too weak' =>"Très faible",
+ 'Weak'=>"Faible",
+ 'Medium'=>"Moyen",
+ 'Strong'=>"Fort",
+ 'Too strong'=>"Très fort",
+ 'passwordchange:minlength'=>"Nombre minimum de charactères",
+ 'passwordchange:same' => "Vous devez créer un nouveau mot de passe",
+ 'passwordchange:unsafe'=>"Mot de passe interdit",
+ 'passwordchange:start'=>"Utiliser la date d'inscription comme date de départ (par défaut la date de connexion après l'activation sera utilisée)? Tous les utilisateurs s'étant inscrit avant la période choisie devront redéfinir leur mot de passe lors de leur prochaine connexion."
+ );
+
+ add_translation("fr",$french);
+?>
File renamed without changes.
@@ -26,8 +26,20 @@ function password_check_change(){
forward("pg/settings/user/".$user->username);
}
}
+ unregister_plugin_hook('usersettings:save','user','users_settings_save');
+
+ register_plugin_hook('usersettings:save','user','pc_users_settings_save');
}
+ function pc_users_settings_save() {
+ global $CONFIG;
+ include($CONFIG->path . "actions/user/name.php");
+ include($CONFIG->path . "mod/password_change/actions/user/password.php");
+ include($CONFIG->path . "actions/email/save.php");
+ include($CONFIG->path . "actions/user/language.php");
+ include($CONFIG->path . "actions/user/default_access.php");
+ }
+
function checkPassword($C) {
$F = 0;
$B = get_plugin_setting('minlength');

0 comments on commit 40550bc

Please sign in to comment.