From d782038d0fd1153a8ba949b9a22918b75f459e62 Mon Sep 17 00:00:00 2001 From: xisi Date: Mon, 20 Jan 2014 15:38:46 -0500 Subject: [PATCH 1/3] stupid rebase --- public/include/pages/login.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/pages/login.inc.php b/public/include/pages/login.inc.php index 13c8b504..f2e685d5 100644 --- a/public/include/pages/login.inc.php +++ b/public/include/pages/login.inc.php @@ -48,7 +48,7 @@ if ($setting->getValue('maintenance') && !$user->isAdmin($user->getUserId($_POST } } // Check if recaptcha is enabled, process form data if valid - if (($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_logins') != 1 || $rsp->is_valid) && ($nocsrf == 1 || (!$config['csrf']['enabled'] || !$config['csrf']['forms']['login']))) { + if (($setting->getValue('recaptcha_enabled') != 1 || $setting->getValue('recaptcha_enabled_logins') != 1 || $rsp->is_valid) && ($nocsrf == 1 || (!$config['csrf']['enabled'] || in_array('login', $config['csrf']['disabled_forms'])))) { if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) { empty($_POST['to']) ? $to = $_SERVER['SCRIPT_NAME'] : $to = $_POST['to']; $port = ($_SERVER["SERVER_PORT"] == "80" or $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]); From b0053b65e16f271ca99d387a741bd1109d04e267 Mon Sep 17 00:00:00 2001 From: xisi Date: Mon, 20 Jan 2014 23:57:01 -0500 Subject: [PATCH 2/3] Added basic javascript password strength/match testing Added pw strength/match to registration form --- public/site_assets/mpos/js/pwcheck.js | 78 ++++++++++++++++++++++ public/templates/mpos/master.tpl | 2 +- public/templates/mpos/register/default.tpl | 8 ++- 3 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 public/site_assets/mpos/js/pwcheck.js diff --git a/public/site_assets/mpos/js/pwcheck.js b/public/site_assets/mpos/js/pwcheck.js new file mode 100644 index 00000000..5433d012 --- /dev/null +++ b/public/site_assets/mpos/js/pwcheck.js @@ -0,0 +1,78 @@ +function scorePassword(pass) { + var score = 0; + if (!pass) + return score; + var letters = new Object(); + for (var i=0; i= 80) + return "Excellent"; + if (score >= 70) + return "Strong"; + if (score >= 50) + return "Good"; + if (score >= 40) + return "Weak"; + if (score >= 10) + return "Very weak"; + if (score < 10 && score > 1) + return "Extremely weak"; + return ""; +} +function getStrengthColor(pass) { + var score = scorePassword(pass) + if (score >= 80) + return "#390" + if (score >= 70) + return "#3C0" + if (score >= 50) + return "#399" + if (score >= 40) + return "#F60" + if (score >= 10) + return "#E00" + if (score < 10) + return "#C00" + return "#999" +} +function checkIfPasswordsMatch() { + var pwMatch = document.getElementById('pw_match'); + var field1 = document.getElementById('pw_field').value; + var field2 = document.getElementById('pw_field2').value; + if (field1 == field2 && field1 !== "" && field2 !== "") { + pwMatch.innerHTML = "Passwords match!"; + pwMatch.style.color = "#390"; + } else if (field1 == "" || field2 == ""){ + pwMatch.innerHTML = ""; + } else { + pwMatch.innerHTML = "Passwords don't match!"; + pwMatch.style.color = "#399"; + } +} +$(document).ready(function() { + $("#pw_field,#pw_field2").on("keypress keyup keydown", function() { + var fieldValue = document.getElementById('pw_field').value; + var pwStrength = document.getElementById('pw_strength'); + pwStrength.innerHTML = checkPassStrength(fieldValue); + pwStrength.style.color = getStrengthColor(fieldValue); + checkIfPasswordsMatch(); + }); +}); \ No newline at end of file diff --git a/public/templates/mpos/master.tpl b/public/templates/mpos/master.tpl index c20a966b..13159ce9 100644 --- a/public/templates/mpos/master.tpl +++ b/public/templates/mpos/master.tpl @@ -29,7 +29,7 @@ - + {if $GLOBAL.statistics.analytics.enabled} {$GLOBAL.statistics.analytics.code nofilter} {/if} diff --git a/public/templates/mpos/register/default.tpl b/public/templates/mpos/register/default.tpl index bea79a6f..eabec47f 100644 --- a/public/templates/mpos/register/default.tpl +++ b/public/templates/mpos/register/default.tpl @@ -14,10 +14,12 @@
- - + +

Strength

+ - +

+
From a20c2324e29ae7904cceafdd19069c5ea5aaf7f3 Mon Sep 17 00:00:00 2001 From: xisi Date: Tue, 21 Jan 2014 00:02:57 -0500 Subject: [PATCH 3/3] Added pw strength/match to change password form --- public/templates/mpos/account/edit/default.tpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/templates/mpos/account/edit/default.tpl b/public/templates/mpos/account/edit/default.tpl index cea3d882..4a8e81c4 100644 --- a/public/templates/mpos/account/edit/default.tpl +++ b/public/templates/mpos/account/edit/default.tpl @@ -144,11 +144,13 @@
- {nocache}{/nocache} +

+ {nocache}{/nocache}
- {nocache}{/nocache} +

+ {nocache}{/nocache}