#458 fixes on tests, validator and model/user

This commit is contained in:
Antonio Cordeddu
2022-08-10 13:15:08 +02:00
parent d25012ad02
commit 5ee14138bc
3 changed files with 4 additions and 3 deletions

View File

@ -252,7 +252,7 @@ class User extends ActiveRecord implements IdentityInterface
'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16], 'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16],
'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean'], 'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean'],
'twoFactorTypeLength' => ['auth_tf_type', 'string', 'max' => 20], 'twoFactorTypeLength' => ['auth_tf_type', 'string', 'max' => 20],
'twoFactorTypeLength' => ['auth_tf_mobile_phone', 'string', 'max' => 20], 'twoFactorMobilePhoneLength' => ['auth_tf_mobile_phone', 'string', 'max' => 20],
]; ];
} }

View File

@ -16,7 +16,7 @@ use Da\TwoFA\Manager;
use Da\User\Contracts\ValidatorInterface; use Da\User\Contracts\ValidatorInterface;
use Da\User\Model\User; use Da\User\Model\User;
use Da\User\Traits\ContainerAwareTrait; use Da\User\Traits\ContainerAwareTrait;
use Da\User\Service\TwoFactorEmailCodeGeneratorService; use Da\User\Service\TwoFactorQrCodeUriGeneratorService;
use Yii; use Yii;
class TwoFactorCodeValidator implements ValidatorInterface class TwoFactorCodeValidator implements ValidatorInterface
@ -94,6 +94,6 @@ class TwoFactorCodeValidator implements ValidatorInterface
*/ */
public function generateCode() public function generateCode()
{ {
return $this->make(TwoFactorEmailCodeGeneratorService::class,[$this->user])->run(); return $this->make(TwoFactorQrCodeUriGeneratorService::class,[$this->user])->run();
} }
} }

View File

@ -81,6 +81,7 @@ return [
'auth_key' => '39HU0m5lpjWtqstFVGFjj6lFb7UZDeRq', 'auth_key' => '39HU0m5lpjWtqstFVGFjj6lFb7UZDeRq',
'auth_tf_key' => '', 'auth_tf_key' => '',
'auth_tf_enabled' => true, 'auth_tf_enabled' => true,
'auth_tf_type' => 'google-authenticator',
'created_at' => $time, 'created_at' => $time,
'updated_at' => $time, 'updated_at' => $time,
'confirmed_at' => $time, 'confirmed_at' => $time,