1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-23 23:47:37 +00:00
Files
matomo/plugins/MobileMessaging/SMSProvider/Development.php
Stefan Giehl 840029ed3e Various improvements to number verification workflow in MobileMessaging (#22668)
* Adjust Development SMS provider to log messages instead of a notification

Notifications don't work here correctly anymore, as the messages are sent through the API, where access to the session may not be possible"

* Extend verification code to 6 alhpanumeric characters

* Limit number of unverified phone numbers to 3 per user

* Add confirmation when removing a phone number

* Store verification details and ensure that verification code expires after 3 failed tries or 10 minutes

* Sort numbers in UI so unverified are listed first

* improve usability of phone number management

* Add possibility to resend a verification code

* fix a couple of tests

* Adds some more tests

* move UI tests to plugin

* adds some more UI tests

* Only validate numbers when adding them

* apply some review feedback
2024-10-14 17:02:31 +02:00

62 خطوط
1.3 KiB
PHP

<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\MobileMessaging\SMSProvider;
use Piwik\Container\StaticContainer;
use Piwik\Log\LoggerInterface;
use Piwik\Plugins\MobileMessaging\SMSProvider;
use Piwik\Development as PiwikDevelopment;
/**
* Used for development only
*
* @ignore
*/
class Development extends SMSProvider
{
public function getId()
{
return 'Development';
}
public function getDescription()
{
return 'Development SMS Provider<br />All sent SMS will be logged on info level';
}
public function isAvailable()
{
return PiwikDevelopment::isEnabled();
}
public function verifyCredential($credentials)
{
return true;
}
public function getCredentialFields()
{
return array();
}
public function sendSMS($credentials, $smsText, $phoneNumber, $from)
{
StaticContainer::get(LoggerInterface::class)->info(
'SMS sent from {from}, to {to}: {message}',
['from' => $from, 'to' => $phoneNumber, 'message' => $smsText]
);
}
public function getCreditLeft($credentials)
{
return 'Balance: 42';
}
}