vTiger Customizations – Part 3 – Enforcing strong passwords in the Customer Portal
This is a continuation from Part 2 – Enforcing strong passwords in vTiger.
I submitted the updates to the Trac site for vTiger as diff updates to the 5.2.0 code, which might be easier to use to update the code.
Implementing the enforcement of strong passwords in the vTiger Customer Portal is easy to do. Again, I’ll divide this up into 2 sections, the Front end (Javascript) code and the Back end (PHP) code:
1.) Customer Portal Front end password enforcement (Customer Portal Javascript)
2.) Customer Portal Back end password enforcement (Customer Portal PHP code)
1.) Customer Portal Front end password enforcement to vtiger/customerportal/MySettings.php –> F/E
Line: 134
-confirmpw = trim(form.confirm_password.value);
var passwordCheckRegex = new RegExp(“^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$”, “g”);
-if(oldpw == ”)
-{
Line 149:
else if (passwordCheckRegex.test(trim(newpw)) == false) {
alert(“Password not strong enough. Please enter a password 8 characters or more, 1 upper case letter, 1 lower case letter and 1 number”);
return false;
}
2.) Customer Portal Back end password enforecment in vtigercrm/customerportal/HelpDesk/Utils.php –> B/E
Line: 115
-if(strcasecmp($newpw,$confirmpw) == 0)
-{
if (preg_match(‘/^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$/’, $newpw, $matches) >= 1) {
-$customerid = $result[0]['id'];
-// $customerid = $_SESSION['customer_id'];
-$sessionid = $_SESSION['customer_sessionid'];
… // WRAP THE IF AROUND THE PASSWORD UPDATE CODE
}
else
{
$errormsg .= ‘Password not strong enough. Please enter a password 8 characters or more, 1 upper case letter, 1 lower case letter and 1 number’;
}
-}
-else
-{
-$errormsg .= getTranslatedString(‘MSG_ENTER_NEW_PASSWORDS_SAME’);
-}
NOTE: As I stated in the last post, I did not create this regex. I used the medium regex created found by Doug in his post found here.
Now, you can rest a little better knowing that your customers are using strong passwords on your Customer Portal site. I hope you found this helpful!
Resources: Check Password Strength with Javascript and Regular Expressions
-
Articles
- October 2011
- September 2011
- July 2011
- June 2011
- March 2011
- February 2011
- December 2010
- November 2010
- October 2010
- August 2010
- July 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- October 2009
- July 2009
- June 2007
- May 2007
- April 2007
- January 2007
- June 2006
- November 2005
- October 2005
-
Calendar
May 2013 M T W T F S S « Oct 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 -
Meta






