mirror of
https://github.com/elyby/accounts.git
synced 2024-11-26 16:52:02 +05:30
Update dependencies
This commit is contained in:
parent
40eca5b8b6
commit
26f7d6213f
@ -1,12 +1,12 @@
|
||||
namespace: api\tests
|
||||
actor_suffix: Tester
|
||||
bootstrap: _bootstrap.php
|
||||
paths:
|
||||
tests: tests
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
helpers: tests/_support
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
coverage:
|
||||
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
namespace api\modules\accounts\models;
|
||||
|
||||
use common\models\Account;
|
||||
use OTPHP\TOTP;
|
||||
|
||||
trait TotpHelper {
|
||||
|
||||
abstract public function getAccount(): Account;
|
||||
|
||||
protected function getTotp(): TOTP {
|
||||
$account = $this->getAccount();
|
||||
$totp = TOTP::create($account->otp_secret);
|
||||
$totp->setLabel($account->email);
|
||||
$totp->setIssuer('Ely.by');
|
||||
|
||||
return $totp;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace api\modules\accounts\models;
|
||||
|
||||
use api\exceptions\ThisShouldNotHappenException;
|
||||
@ -9,10 +11,11 @@ use BaconQrCode\Renderer\Color\Rgb;
|
||||
use BaconQrCode\Renderer\Image\Svg;
|
||||
use BaconQrCode\Writer;
|
||||
use common\components\Qr\ElyDecorator;
|
||||
use OTPHP\TOTP;
|
||||
use OTPHP\TOTPInterface;
|
||||
use ParagonIE\ConstantTime\Base32;
|
||||
|
||||
class TwoFactorAuthInfo extends BaseAccountForm {
|
||||
use TotpHelper;
|
||||
|
||||
public function getCredentials(): array {
|
||||
if (empty($this->getAccount()->otp_secret)) {
|
||||
@ -28,6 +31,15 @@ class TwoFactorAuthInfo extends BaseAccountForm {
|
||||
];
|
||||
}
|
||||
|
||||
private function getTotp(): TOTPInterface {
|
||||
$account = $this->getAccount();
|
||||
$totp = TOTP::create($account->otp_secret);
|
||||
$totp->setLabel($account->email);
|
||||
$totp->setIssuer('Ely.by');
|
||||
|
||||
return $totp;
|
||||
}
|
||||
|
||||
private function drawQrCode(string $content): string {
|
||||
$content = $this->forceMinimalQrContentLength($content);
|
||||
|
||||
@ -89,7 +101,7 @@ class TwoFactorAuthInfo extends BaseAccountForm {
|
||||
* @return string
|
||||
*/
|
||||
private function generateOtpSecret(int $length): string {
|
||||
$randomBytesLength = ceil($length / 1.6);
|
||||
$randomBytesLength = (int)ceil($length / 1.6);
|
||||
$result = '';
|
||||
while (strlen($result) < $length) {
|
||||
/** @noinspection PhpUnhandledExceptionInspection */
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace: common\tests
|
||||
actor_suffix: Tester
|
||||
bootstrap: _bootstrap.php
|
||||
paths:
|
||||
tests: tests
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
helpers: tests/_support
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
coverage:
|
||||
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace common\components;
|
||||
|
||||
use Domnikl\Statsd\Client;
|
||||
@ -80,7 +82,7 @@ class StatsD extends Component {
|
||||
|
||||
protected function createConnection(): Connection {
|
||||
if (!empty($this->host) && !empty($this->port)) {
|
||||
return new Connection\UdpSocket($this->host, $this->port);
|
||||
return new Connection\UdpSocket($this->host, (int)$this->port);
|
||||
}
|
||||
|
||||
return new Connection\Blackhole();
|
||||
|
@ -14,7 +14,7 @@
|
||||
"ext-simplexml": "*",
|
||||
"ext-sodium": "*",
|
||||
"bacon/bacon-qr-code": "^1.0",
|
||||
"domnikl/statsd": "^2.6",
|
||||
"domnikl/statsd": "^3.0.0",
|
||||
"ely/mojang-api": "^0.2.0",
|
||||
"ely/yii2-tempmail-validator": "^2.0",
|
||||
"goaop/framework": "^2.2.0",
|
||||
@ -26,7 +26,7 @@
|
||||
"paragonie/constant_time_encoding": "^2.0",
|
||||
"ramsey/uuid": "^3.5",
|
||||
"sam-it/yii2-mariadb": "^1.1",
|
||||
"spomky-labs/otphp": "^9.0.2",
|
||||
"spomky-labs/otphp": "^10.0.0",
|
||||
"webmozart/assert": "^1.2.0",
|
||||
"yiisoft/yii2": "~2.0.20",
|
||||
"yiisoft/yii2-queue": "^2.2.0",
|
||||
@ -34,7 +34,7 @@
|
||||
"yiisoft/yii2-swiftmailer": "~2.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeception/codeception": "^3.0",
|
||||
"codeception/base": "^3.1.0",
|
||||
"codeception/specify": "^1.0.0",
|
||||
"ely/php-code-style": "^0.3.0",
|
||||
"flow/jsonpath": "^0.4.0",
|
||||
|
1761
composer.lock
generated
1761
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,12 @@
|
||||
namespace: console\tests
|
||||
actor_suffix: Tester
|
||||
bootstrap: _bootstrap.php
|
||||
paths:
|
||||
tests: tests
|
||||
log: tests/_output
|
||||
data: tests/_data
|
||||
helpers: tests/_support
|
||||
settings:
|
||||
bootstrap: _bootstrap.php
|
||||
colors: true
|
||||
memory_limit: 1024M
|
||||
coverage:
|
||||
|
Loading…
Reference in New Issue
Block a user