diff options
author | Jerome Bakker <jeabakker@coldtrick.com> | 2013-09-30 10:34:22 +0200 |
---|---|---|
committer | Jerome Bakker <jeabakker@coldtrick.com> | 2013-09-30 10:34:22 +0200 |
commit | ceb9829595b62330ec0d6903287c498e6d6ee37c (patch) | |
tree | e3740af54bfed84bc54a094d437eb9b1cc0a9999 | |
parent | 3a68d33d8b0ce41c0a94331ba772e64544406fab (diff) | |
download | elgg-ceb9829595b62330ec0d6903287c498e6d6ee37c.tar.gz elgg-ceb9829595b62330ec0d6903287c498e6d6ee37c.tar.bz2 |
fixes #6100 auth_gettoken now works with email address
-rw-r--r-- | engine/lib/web_services.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/engine/lib/web_services.php b/engine/lib/web_services.php index b440e3afb..51cad6f39 100644 --- a/engine/lib/web_services.php +++ b/engine/lib/web_services.php @@ -1166,6 +1166,17 @@ function list_all_apis() { * @access private */ function auth_gettoken($username, $password) { + // check if username is an email address
+ if (is_email_address($username)) {
+ $users = get_user_by_email($username);
+
+ // check if we have a unique user
+ if (is_array($users) && (count($users) == 1)) {
+ $username = $users[0]->username;
+ }
+ }
+
+ // validate username and password if (true === elgg_authenticate($username, $password)) { $token = create_user_token($username); if ($token) { @@ -1195,7 +1206,7 @@ $ERRORS = array(); * * @return void * @access private - * + * * @throws Exception */ function _php_api_error_handler($errno, $errmsg, $filename, $linenum, $vars) { |