Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2020-01-12 22:51:17 +0300
committerGitHub <noreply@github.com>2020-01-12 22:51:17 +0300
commite775c3c0149b842f8bfdcdfe4733e5e5736adb4f (patch)
tree27e0c769c0e25fbc5d1b16a55f1f216ae24c6f6a /plugins/UsersManager
parent863d0d66096a5c46ec6f35335dbf90cdda93e682 (diff)
Support email address in getTokenAuth (#15371)
* Support email address in getTokenAuth Fix https://github.com/matomo-org/matomo-mobile-2/issues/5404 Not writing a test for it as I'm removing this API method as part of #6559 anyway. * Update API.php
Diffstat (limited to 'plugins/UsersManager')
-rw-r--r--plugins/UsersManager/API.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index d7f6bc33ee..08cf1312c0 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -1351,7 +1351,7 @@ class API extends \Piwik\Plugin\API
*
* If the username/password combination is incorrect an invalid token will be returned.
*
- * @param string $userLogin Login
+ * @param string $userLogin Login or Email address
* @param string $md5Password hashed string of the password (using current hash function; MD5-named for historical reasons)
* @return string
*/
@@ -1361,6 +1361,14 @@ class API extends \Piwik\Plugin\API
$user = $this->model->getUser($userLogin);
+ if (empty($user) && Piwik::isValidEmailString($userLogin)) {
+ $user = $this->model->getUserByEmail($userLogin);
+
+ if (!empty($user['login'])) {
+ $userLogin = $user['login'];
+ }
+ }
+
if (empty($user) || !$this->password->verify($md5Password, $user['password'])) {
/**
* @ignore