From 2b8a925a12155b5e7692b5ccb035d49d70ddde45 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 9 Apr 2010 22:06:52 +0000 Subject: Allow login via email. git-svn-id: http://code.elgg.org/elgg/trunk@5678 36083f99-b078-4883-b0ff-0f9b5a30f544 --- actions/login.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'actions/login.php') diff --git a/actions/login.php b/actions/login.php index 3b215da66..fed45fbc5 100644 --- a/actions/login.php +++ b/actions/login.php @@ -16,7 +16,13 @@ $persistent = get_input("persistent", false); // If all is present and correct, try to log in $result = false; if (!empty($username) && !empty($password)) { - if ($user = authenticate($username,$password)) { + // check first if this is an email address and do a login + // email addies will be validated + if (strpos($username, '@') !== FALSE && ($user=get_user_by_email($username))) { + $username = $user[0]->username; + } + + if ($user = authenticate($username, $password)) { $result = login($user, $persistent); } } @@ -29,7 +35,7 @@ if ($result) { unset($_SESSION['last_forward_from']); forward($forward_url); } else { - if ( (isadminloggedin()) && (!datalist_get('first_admin_login'))) { + if ((isadminloggedin()) && (!datalist_get('first_admin_login'))) { system_message(elgg_echo('firstadminlogininstructions')); datalist_set('first_admin_login', time()); -- cgit v1.2.3