Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Admin Change Customer Passwords


kymation

Recommended Posts

<double post - been a long time since I did that>

Edited by germ

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 1 month later...

Using "Admin Change Customers Password v3.3"

 

I got rid of this issue myself, by renaming the functions in the password_funcs.php (now renamed password_funcs_change_password.php in the Contribution version 3.3) - the new one from the contribution.

 

Those new functions, I renamed as:

tep_validate_password_change

and

tep_encrypt_password_change

 

THEN, in change_password.php:

Find around line 53: SET customers_password='" . tep_encrypt_password ($new_password) . "'</p>

and CHANGE to: SET customers_password='". tep_encrypt_password_change ($new_password) . "'</p>

 

In my version, I didn't have a line for tep_validate_password, but if you do, then change that one to tep_validate_password_change.

 

Fatal error: Cannot redeclare tep_validate_password() (previously declared in /home/xxxxxx/public_html/acquire_wine/xxxxxx/includes/functions/password_funcs.php:16) in /home/xxxxxxx/public_html/acquire_wine/xxxxx/includes/functions/password_funcs.php on line 29
Edited by The Munch
Link to comment
Share on other sites

  • 3 weeks later...

I just want to thank stu2000 (post 65) and kymation (post 64) for this automated emailer.. it works great on my osc 2.3.1!

Thank you, it works now, using the following code:
// If all is well, make the changes to the database if ($pass == 1) { mysql_query("UPDATE " . TABLE_CUSTOMERS . " SET customers_password='" . tep_encrypt_password ($new_password) . "' WHERE customers_id='" . $customer_id . "' "); // Get the customer's information for the success message $customer_name_query = mysql_query("SELECT customers_firstname, customers_lastname, customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . $customer_id . "' "); $customer_name = mysql_fetch_array ($customer_name_query); define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password'); define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . ' %s' . "\n\n"); tep_mail($customer_name['customers_firstname'] . " " . $customer_name['customers_lastname'], $customer_name['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } }

Email received:

A new password was requested for your account at Company Name. Your new password to 'Company Name' is: 12345

Just need to do a few cosmetic changes etc and should be perfect.

$customer_data is used to pull an array of all customers. It won't be valid for the current customer when the password has been changed -- that's in the POST section. You need to add your own SQL or change the existing to retrieve the correct customer information. Try this around Line 51:
 $customer_name_query = mysql_query("SELECT customers_firstname, customers_lastname FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . $customer_id . "' "); $customer_name = mysql_fetch_array ($customer_name_query);

Change to:

 $customer_name_query = mysql_query("SELECT customers_firstname, customers_lastname, customers_email_address FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . $customer_id . "' "); $customer_name = mysql_fetch_array ($customer_name_query);

Then use $customer_name['customers_email_address'] etc. to populate your email. I would put the email code up in this section as well; the part you referenced was supposed to be for error/success messages. Regards Jim Edit: Apparently I was doing this at the same time the parent post was changed. I was referring to the first block of code -- the second code block is very close tho what I was suggesting. That really should work if you retrieve the email address.

Edited by The Munch
Link to comment
Share on other sites

  • 3 months later...
  • 9 months later...

This contribution allows you to change a customer's password from your Admin.

 

I noticed there isn't a support thread for this one, so here it is.

 

I'll post version 3.0 in a minute. I've updated the code to fix a couple of bugs, including a global variable conflict with 2.2rc1. I've also added an automatic password generator and a button to use this function from the existing Customers page. The whole thing could probably be integrated into the Customers page, but I'm not going there. Feel free if you want to.

 

This version could also use some help with translations. If you can do one, please upload a complete copy to the Contributions page.

 

The contribution can be found here.

 

Regards

Jim

 

 

Add on works very good on PHP 5.2. It needs some corrections with PHP 5.3 since eregi() is no longer valid

 

Deprecated: Function eregi() is deprecated in ....

 

Add on still does the work but it shows above error in admin section.

 

Did someone get fix for PHP 5.3?

 

Thanks

Link to comment
Share on other sites

Add on works very good on PHP 5.2. It needs some corrections with PHP 5.3 since eregi() is no longer valid

 

Deprecated: Function eregi() is deprecated in ....

 

Add on still does the work but it shows above error in admin section.

 

Did someone get fix for PHP 5.3?

 

Thanks

 

Found answer for me own question.

 

http://www.oscommerce.com/forums/topic/382845-need-help-to-resolve-problem-in-generalphp/

 

Post #5

 

Thanks Heather

Link to comment
Share on other sites

  • 1 year later...
  • 6 months later...

Hi!  Installations was a breeze and everything seems to be working fantastic on the Admin side.  I get confirmation on the Admin side that the password has been changed, but when I try to use the new password on the Customer side, it get "Error: No match for E-Mail Address and/or Password."  Any suggestions?

Link to comment
Share on other sites

  • 8 months later...

Almost everything working fine. This is such a useful contribution it should be made part of the core code! Tks for sharing. :)

 

The only issue I found is that no email is being sent to client after password is reset.

I'm using v2.3.4 and PHP 5.2.17

Can anybody help with this?

 

TIA!

 

Thank you, it works now, using the following code:
 

// If all is well, make the changes to the database
	if ($pass == 1) {
	  mysql_query("UPDATE " . TABLE_CUSTOMERS . "
				   SET customers_password='" . tep_encrypt_password ($new_password) . "'
				   WHERE customers_id='" . $customer_id . "'
				");

// Get the customer's information for the success message
$customer_name_query = mysql_query("SELECT customers_firstname,
												 customers_lastname,
												 customers_email_address
										  FROM " . TABLE_CUSTOMERS . "
										  WHERE customers_id='" . $customer_id . "'
									   ");
	  $customer_name = mysql_fetch_array ($customer_name_query);

  define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password');
  define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . '   %s' . "\n\n");
  tep_mail($customer_name['customers_firstname'] . " " . $customer_name['customers_lastname'], $customer_name['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
	 }
  }
Email received:

A new password was requested for your account at Company Name.

Your new password to 'Company Name' is:

   12345
Just need to do a few cosmetic changes etc and should be perfect.

 

 

Patty

Link to comment
Share on other sites

Can anybody shed a light, please??

I really can't figure out what's wrong.

I need help! :(

 

Go to Admin -> Configuration -> My Store and enter there under "Store Name" the name of your store.

Link to comment
Share on other sites

Go to Admin -> Configuration -> My Store and enter there under "Store Name" the name of your store.

Tks for your reply, but the store name was added. Any other idea?

Patty

Link to comment
Share on other sites

@@Patty

 

Ok, the version I use is a little bit different:

// If all is well, make the changes to the database
    if ($pass == 1) {
      tep_db_query("update customers set customers_password='" . tep_encrypt_password ($new_password) . "' where customers_id='" . (int)$customer_id . "'");

// Get the customer's information for the success message
      $customer_name_query = tep_db_query("select customers_firstname, customers_lastname, customers_guest from customers where customers_id='" . (int)$customer_id . "' and customers_guest = '0'");
      $customer_name = tep_db_fetch_array($customer_name_query);

      tep_mail($customer_name['customers_firstname'] . " " . $customer_name['customers_lastname'], $customer_name['customers_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
  }
// End POST section

And this part:

define('EMAIL_PASSWORD_REMINDER_SUBJECT', STORE_NAME . ' - New Password');
define('EMAIL_PASSWORD_REMINDER_BODY', 'A new password was requested for your account at ' . STORE_NAME . '.' . "\n\n" . 'Your new password to \'' . STORE_NAME . '\' is:' . "\n\n" . '   %s' . "\n\n");

is moved to admin/includes/languages/Your_language/change_password.php - where it belongs to!

 

J.J.

Link to comment
Share on other sites

@@De Dokta Tks again for your reply.

I moved the language strings to the language file as you suggested, everything else is pretty much the same. But still no email is being sent.

I checked the server's log and it's not being sent at all. But I do receive other emails from the store, so email function is working.

 

What else could be wrong?

Patty

Link to comment
Share on other sites

  • 6 months later...

I've installed your contrib just this minute and get an error when clicking on "change password":

Fatal error: Call to undefined function tep_create_random_value() in /home/alltirescenter/public_html/admin/change_password.php on line 110

 

Ani help will be appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...