Recover username/password with email only

Discussion forum for MOD Writers regarding MOD Development.
Locked
killa101
Registered User
Posts: 265
Joined: Thu Apr 15, 2004 12:19 am

Recover username/password with email only

Post by killa101 » Thu Dec 02, 2010 2:04 pm

Hi all,

Is there a way to set the "Forgot Password" form to require only the email address for recovering login information? My board has a lot of old members that keep forgetting both their username and password.

Cheers,
Jordan

User avatar
imkingdavid
Former Team Member
Posts: 2667
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: Recover username/password with email only

Post by imkingdavid » Sat Dec 04, 2010 6:19 am

Untested, but you can try it and revert back to the original code if it doesn't work.

Open includes/ucp/ucp_remind.php
Find:

Code: Select all

$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
                FROM ' . USERS_TABLE . "
                WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
                    AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; 
Replace with:

Code: Select all

$sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
                FROM ' . USERS_TABLE . "
                WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'" .
                    ((!empty($username)) ? "AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : ''); 
Basically I just changed it to say to only check for the username if it is entered. But they'll still need to know the proper email address. Let me know whether or not that works.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

CarolC1
Registered User
Posts: 565
Joined: Sat Dec 02, 2006 4:26 pm

Re: Recover username/password with email only

Post by CarolC1 » Thu Nov 10, 2011 5:30 am

Tested on 3.0.9. The code to find is slightly different but you can see what to change. Worked beautifully for me. Thank you!

Locked

Return to “[3.0.x] MOD Writers Discussion”