Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Request new password problems


mike_steinhoff

Recommended Posts

Posted

When a customer requests a new password on my site, it sends them characters that they cannot typ into their computer. Is there a way to change this. I have included the email I received below.

 

A new password was requested from 65.222.108.141.

 

Your new password to 'Karaoke On Fire' is:

 

cC???

 

Any thoughts ?

There is no spoon.

Posted

I had the same problem, and did the following to get some easier random passwords:

 

1. open catalog/includes/functions/general.php

 

2. Search for: tep_create_random_value

 

3. Change the original code

 

from:

  function tep_create_random_value($length, $type = 'mixed') {

   if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false;



   $rand_value = '';

   while (strlen($rand_value) < $length) {

     if ($type == 'digits') {

       $char = tep_rand(0,9);

     } else {

       $char = chr(tep_rand(0,255));

     }

     if ($type == 'mixed') {

       if (eregi('^[a-z0-9]$', $char)) $rand_value .= $char;

     } elseif ($type == 'chars') {

       if (eregi('^[a-z]$', $char)) $rand_value .= $char;

     } elseif ($type == 'digits') {

       if (ereg('^[0-9]$', $char)) $rand_value .= $char;

     }

   }

 

 

to:

  function tep_create_random_value($length, $type = 'mixed') {

   if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false;



   $rand_value = '';

   while (strlen($rand_value) < $length) {

     if ($type == 'digits') {

       $char = tep_rand(0,9);

     } else {

       $char = chr(tep_rand(0,122));

     }

     if ($type == 'mixed') {

       if (eregi('^[a-z0-9]$', $char)) $rand_value .= $char;

     } elseif ($type == 'chars') {

       if (eregi('^[a-z]$', $char)) $rand_value .= $char;

     } elseif ($type == 'digits') {

       if (ereg('^[0-9]$', $char)) $rand_value .= $char;

     }

   }

 

Note that the only thing I changed is the line:

$char = chr(tep_rand(0,255));

into:

$char = chr(tep_rand(0,122));

 

ASCII character 122 is 'z' so now it only searches up to that character in the ASCII table.

 

Hope this helps.

  • 4 weeks later...
Posted

This worked for me! Only recently found this issue, and after about 1 minute of searching, this fix worked great.

 

FYI, line from our PHPInfo (in case it mattered):

 

Apache/1.3.27 (Unix) (Red-Hat/Linux) FrontPage/5.0.2.2623 mod_ssl/2.8.12 OpenSSL/0.9.6b DAV/1.0.3 PHP/4.1.2 mod_perl/1.26

 

:)

=======================

Andy Wood - Stereo Connection

Ontario, Canada

=======================

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...