Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 06:20 pm EST

Geeklog Forums

Email address instead of username to login


Davidas

Anonymous
Is it possible to let users of your GL site login with their email address instead of their username ?
Which settings do I have to change ?
Let me know guys ...
Regards, David
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Since the email address has to be unique, it should be possible to do that. But I'm not aware of anyone ever trying it.

bye, Dirk
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
To start, you would need to change SEC_authenticate (in lib-security.php) to allow "username" to be an email address. Simplest way to do that is to assume any username with a '@' sign is an email. Then compare the value against the email field insted of the username field. Like this:

// replace $result = DB_query("SELECT ...."Wink; with
if (strchr($username,'@'Wink !== FALSE) {
$sql = "SELECT .... WHERE email = '$username' and ...";
} else {
$sql = // the original sql statement
}
$result = DB_query($sql);

You might also change the text on the login template to "user name or email:"

That should get you 95% of it. I'm not sure what other gotchas there might be though so you would need to test it well.
 Quote

All times are EST. The time is now 06:20 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content