Check URI validity after QR code upload

This commit is contained in:
Bubka
2020-01-09 17:32:27 +01:00
parent 93f7c4a709
commit 140cedccf3
2 changed files with 19 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Classes;
use OTPHP\TOTP;
use OTPHP\Factory;
use Assert\AssertionFailedException;
class TimedTOTP
{
@@ -16,10 +17,11 @@ class TimedTOTP
*/
public static function get($uri)
{
try {
$otp = Factory::loadFromProvisioningUri($uri);
}
catch (InvalidArgumentException $exception) {
catch (AssertionFailedException $exception) {
return false;
}