close #326 fix rule for the user auth_tf_enabled field
This commit is contained in:
@ -11,15 +11,19 @@
|
|||||||
|
|
||||||
namespace Da\User\Migration;
|
namespace Da\User\Migration;
|
||||||
|
|
||||||
use yii\db\Migration;
|
|
||||||
use Da\User\Helper\MigrationHelper;
|
use Da\User\Helper\MigrationHelper;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
class m000000_000006_add_two_factor_fields extends Migration
|
class m000000_000006_add_two_factor_fields extends Migration
|
||||||
{
|
{
|
||||||
public function safeUp()
|
public function safeUp()
|
||||||
{
|
{
|
||||||
$this->addColumn('{{%user}}', 'auth_tf_key', $this->string(16));
|
$this->addColumn('{{%user}}', 'auth_tf_key', $this->string(16));
|
||||||
$this->addColumn('{{%user}}', 'auth_tf_enabled', $this->boolean()->defaultValue(MigrationHelper::getBooleanValue($this->db->driverName,false)));
|
$this->addColumn(
|
||||||
|
'{{%user}}',
|
||||||
|
'auth_tf_enabled',
|
||||||
|
$this->boolean()->defaultValue(MigrationHelper::getBooleanValue($this->db->driverName))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function safeDown()
|
public function safeDown()
|
||||||
|
|||||||
@ -248,7 +248,7 @@ class User extends ActiveRecord implements IdentityInterface
|
|||||||
// two factor auth rules
|
// two factor auth rules
|
||||||
'twoFactorSecretTrim' => ['auth_tf_key', 'trim'],
|
'twoFactorSecretTrim' => ['auth_tf_key', 'trim'],
|
||||||
'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16],
|
'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16],
|
||||||
'twoFactorEnabledNumber' => ['auth_tf_enabled', 'integer']
|
'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user