Forums / Cotonti / General / Login With Email

chobblr
#1 2009-05-21 04:53
Hi is it possible to have it so users have to sign in with there email address they registered instead of there username.
Lombi
#2 2009-05-21 04:54
It isnt. But as usual, with a lot of hacking, it would be.
<a href="http://www.domenlo.com">Surreal Art</a>
chobblr
#3 2009-05-21 05:00
hmmm.. dammm, don't want to keep hacking, is there a alternative ?
Lombi
#4 2009-05-21 05:04
Sorry :)
<a href="http://www.domenlo.com">Surreal Art</a>
chobblr
#5 2009-05-21 05:24
No worries. its ok,

edit: also is it possable for usernames to be like chobblr.cottonti.com ?
This post was edited by chobblr (2009-05-21 05:27, 14 years ago)
Lombi
#6 2009-05-21 07:06
We'd have to register cottonti.com for that :-D

It is, I had this running on two domains with the beta url system, but the one posted doesnt do that since it's crashing with the category system.

But yea, possible.
<a href="http://www.domenlo.com">Surreal Art</a>
GHengeveld
#7 2009-05-21 08:54
For the email login thing, you could just set the email address as the username (and optionally use an extra field to replace the username field, so you can still put a username next to posts). I'm not sure @ is allowed in username, but that shouldn't be to hard to bypass.
JonnyM
#8 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.