Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
Technical Personnal Blog

Technical Personnal Blog

Technical Personnal Blog

Technical Personnal Blog

  • Tech
  • Blog
  • Open Source
  • VEGAS
  • CARD
  • Favorite Link
  • Shop
  • Cart
  • Checkout
  • My account
  • Tech
  • Blog
  • Open Source
  • VEGAS
  • CARD
  • Favorite Link
  • Shop
  • Cart
  • Checkout
  • My account
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
opencart

How To Force Customers To Use Strong Passwords In OpenCart

By techsupport
August 18, 2021 2 Min Read
Comments Off on How To Force Customers To Use Strong Passwords In OpenCart

With cyber security becoming a larger concern to businesses online I thought I would write a blog post on how you can ensure that passwords are strong enough on customer accounts.When customers register for an account on a default OpenCart installation, the only requirement seems to be that the password is longer than 4 characters (yes, just four!) and less than 20. Whilst it is up for debate whether there should be a much higher upper limit on the length of passwords, for the case of this blog we will just be looking at forcing the use of specific characters to make passwords more secure rather than focusing on the top limit of characters.Open up the following file:

  • catalog/controller/account/register.php

Towards the bottom of the file there is a section of code which validates the password input section. This is the code which we are going to adapt to make more secure.

f((utf8_strlen($this->request->post['password']) < 4) || (utf8_strlen($this->request->post['password']) > 20)) {     $this->error['password'] = $this->language->get('error_password');}

Below is a custom validation block of code which ensures that the password field has a number, a letter and a symbol. It also ensures that the password field is at least 8 characters long which I think is an acceptable minimum length rather than 4! Just replace the above with the code below to ensure customer passwords are strong enough.

1 2 3if (!preg_match('^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&amp;+=])(?=\S+$).{8,}$', $this->request->post['password'])) {    $this->error['password'] = "Please ensure that your password contains a number, a lowercase letter, and upper case letter, a symbol and is longer than eight characters";

Obviously, store owners will want customers to create strong passwords so they have to deal less with customers claiming their account has been compromised and the added security on passwords in the event of a breach. I think everyone can agree that asking customers for a four character password without checking it is not a secure system so with this short blog you can ensure customers make the right strength passwords.

account/register
account/reset
account/password
checkout/register

Author

techsupport

Follow Me
Other Articles
Previous

https://webpus.com/free-courses/

Next

OC 3.0.2.0 – Password Length & Complexity

Categories

  • Android
  • Blog
  • Favorite Link
  • linux
  • Open Source
  • opencart
  • social
  • Tech
  • Uncategorized

Archives

  • January 2025
  • March 2024
  • August 2023
  • March 2023
  • February 2023
  • November 2021
  • August 2021
  • April 2021
  • March 2021
  • December 2020
  • October 2020
  • September 2020
  • July 2020
  • June 2020
  • May 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • September 2019
  • August 2019
  • June 2019
  • October 2018
  • August 2018
  • May 2018
  • April 2018
  • March 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • June 2017
  • March 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • January 2016
  • December 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
Copyright 2026 — Technical Personnal Blog. All rights reserved. Blogsy WordPress Theme