Forums / Cotonti / General / Login With Email

JonnyM
#12748 2009-05-21 21:52
I looked into the Cotonti files and found that as far as I know, you only have to change one single line of code to allow users to login with their e-mail.

Open the file system/core/users/users.auth.inc.php and find the following line of code ( line nr: 44):
$sql = sed_sql_query("SELECT user_id, user_maingrp, user_banexpire, user_skin, user_theme, user_lang FROM $db_users WHERE user_password='$rmdpass' AND user_name='".sed_sql_prep($rusername)."'");

and change it into:

$sql = sed_sql_query("SELECT user_id, user_maingrp, user_banexpire, user_skin, user_theme, user_lang FROM $db_users WHERE user_password='$rmdpass' AND user_email='".sed_sql_prep($rusername)."'");

Notice how all I did was change the user_name part in the SQL WHERE clause into user_email.

Now I haven't tested this more than logged in once, so it's up to you and at your own risk if you want to use this core hack. But there shouldn't be any problems as far as I can tell.