public function getTokenAuth($userLogin, $md5Password)
    {
        UsersManager::checkPasswordHash($md5Password, Piwik::translate('UsersManager_ExceptionPasswordMD5HashExpected'));

        $user = $this->model->getUser($userLogin);

        if (empty($user) || !$this->password->verify($md5Password, $user['password'])) {
            /**
             * @ignore
             * @internal
             */
            Piwik::postEvent('Login.authenticate.failed', array($userLogin));

            return md5($userLogin . microtime(true) . Common::generateUniqId());
        }

        if ($this->password->needsRehash($user['password'])) {
            $userUpdater = new UserUpdater();
            $userUpdater->updateUserWithoutCurrentPassword($userLogin, $this->password->hash($md5Password));
        }

        return $user['token_auth'];
    }
public function getTokenAuth($userLogin, $md5Password)
    {
        UsersManager::checkPasswordHash($md5Password, Piwik::translate('UsersManager_ExceptionPasswordMD5HashExpected'));

        $user = $this->model->getUser($userLogin);

        if (empty($user) || !$this->password->verify($md5Password, $user['password'])) {
            /**
             * @ignore
             * @internal
             */
            Piwik::postEvent('Login.authenticate.failed', array($userLogin));

            return md5($userLogin . microtime(true) . Common::generateUniqId());
        }

        if ($this->password->needsRehash($user['password'])) {
            $userUpdater = new UserUpdater();
            $userUpdater->updateUserWithoutCurrentPassword($userLogin, $this->password->hash($md5Password));
        }

        return $user['token_auth'];
    }
public function getTokenAuth ( $ userLogin , $ md5Password ) { UsersManager :: checkPasswordHash ( $ md5Password , Piwik :: translate ( 'UsersManager_ExceptionPasswordMD5HashExpected' ) ) ; $ user = $ this -> model -> getUser ( $ userLogin ) ; if ( empty ( $ user ) || ! $ this -> password -> verify ( $ md5Password , $ user [ 'password' ] ) ) { /**
             * @ignore
             * @internal
             */ Piwik :: postEvent ( 'Login.authenticate.failed' , array ( $ userLogin ) ) ; return md5 ( $ userLogin . microtime ( true ) . Common :: generateUniqId ( ) ) ; } if ( $ this -> password -> needsRehash ( $ user [ 'password' ] ) ) { $ userUpdater = new UserUpdater ( ) ; $ userUpdater -> updateUserWithoutCurrentPassword ( $ userLogin , $ this -> password -> hash ( $ md5Password ) ) ; } return $ user [ 'token_auth' ] ; }
Returns the user's API token.

If the username/password combination is incorrect an invalid token will be returned.

@param string $userLogin Login
@param string $md5Password hashed string of the password (using current hash function; MD5-named for historical reasons)
@return string
Returns the user s API token .