Jump to content
kymation

[CONTRIBUTION] Admin Change Customer Passwords

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 >

Share this post


Link to post
Share on other sites

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

Thank You!!

----------

Using: OSC 2.3.1, Algozone Template, Jcow 5 Pro, CometChat 4 Premium.

 

Contributions for OSC-2.3.1: QT Pro 4.6.1, Easy Populate EPv2.77a, Admin Notes, Contribution Tracker, Multi-Product Manager, myQBi Quickbooks Sync, Order Editor 5.0.9, Dynamic Sitemap, Tax ID in Order Editor, Separate Pricing Per Customer v4.2.2 ... etc ...

 

Contributions for OSC-2.2 I've Modified for OSC-2.3.1: Admin Level Account with Categories 2.3.4, File Logging or Email for Failed Admin Login Attempts, Autologon v1.09, Admin Specials by Categories, CCGV 6.0_1, Hide Categories, How Did You Hear About Us, MSRP Listing, Multiple Sales Per Product, osc as info site, OSC Checkout Security Boost v1.1, Points and Rewards Module, Quick Stock Updater, Quick Updates 292, RMA Returns System 2.6, Show Unit Price, Store Mode, Supplier Admin v1.3, Tell A Friend, Required Customer Details v22rc2a, Admin Change Customers Password v3.3, PDF Invoice & PackingSlip 1.6, Quick Price Updates for SPPC v1.5, Country-State Selector v1.5.5 + Limit Countries v2.2, Contact Us Popup Business Card, No Right Click, Delete Customer Account v1.2, Control Login v2.2, Member Type Control v1.1, .... etc...

Share this post


Link to post
Share on other sites

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

Thank You!!

----------

Using: OSC 2.3.1, Algozone Template, Jcow 5 Pro, CometChat 4 Premium.

 

Contributions for OSC-2.3.1: QT Pro 4.6.1, Easy Populate EPv2.77a, Admin Notes, Contribution Tracker, Multi-Product Manager, myQBi Quickbooks Sync, Order Editor 5.0.9, Dynamic Sitemap, Tax ID in Order Editor, Separate Pricing Per Customer v4.2.2 ... etc ...

 

Contributions for OSC-2.2 I've Modified for OSC-2.3.1: Admin Level Account with Categories 2.3.4, File Logging or Email for Failed Admin Login Attempts, Autologon v1.09, Admin Specials by Categories, CCGV 6.0_1, Hide Categories, How Did You Hear About Us, MSRP Listing, Multiple Sales Per Product, osc as info site, OSC Checkout Security Boost v1.1, Points and Rewards Module, Quick Stock Updater, Quick Updates 292, RMA Returns System 2.6, Show Unit Price, Store Mode, Supplier Admin v1.3, Tell A Friend, Required Customer Details v22rc2a, Admin Change Customers Password v3.3, PDF Invoice & PackingSlip 1.6, Quick Price Updates for SPPC v1.5, Country-State Selector v1.5.5 + Limit Countries v2.2, Contact Us Popup Business Card, No Right Click, Delete Customer Account v1.2, Control Login v2.2, Member Type Control v1.1, .... etc...

Share this post


Link to post
Share on other sites

I installled the mod and it was fairly easy, however when I'm viewing change_password.php the admin page will just be blank.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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://forums.oscommerce.com/topic/382845-need-help-to-resolve-problem-in-generalphp/

 

Post #5

 

Thanks Heather

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Can anybody shed a light, please??

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

I need help! :(


Patty

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×