Page 1 of 1

Recover username/password with email only

Posted: Thu Dec 02, 2010 2:04 pm
by killa101
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

Re: Recover username/password with email only

Posted: Sat Dec 04, 2010 6:19 am
by imkingdavid
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.

Re: Recover username/password with email only

Posted: Thu Nov 10, 2011 5:30 am
by CarolC1
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!