diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-09 22:06:52 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-09 22:06:52 +0000 |
commit | 2b8a925a12155b5e7692b5ccb035d49d70ddde45 (patch) | |
tree | ebf4505b0f09b17c97d5cc2c98e2990f55e2fb86 | |
parent | e9e6279885ae5fa299a107160c5f9cd36c2851a6 (diff) | |
download | elgg-2b8a925a12155b5e7692b5ccb035d49d70ddde45.tar.gz elgg-2b8a925a12155b5e7692b5ccb035d49d70ddde45.tar.bz2 |
Allow login via email.
git-svn-id: http://code.elgg.org/elgg/trunk@5678 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | actions/login.php | 10 |
1 files changed, 8 insertions, 2 deletions
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()); |