diff --git a/src/User/Migration/m000000_000006_add_two_factor_fields.php b/src/User/Migration/m000000_000006_add_two_factor_fields.php index 4227069..1aa13ed 100644 --- a/src/User/Migration/m000000_000006_add_two_factor_fields.php +++ b/src/User/Migration/m000000_000006_add_two_factor_fields.php @@ -11,15 +11,19 @@ namespace Da\User\Migration; -use yii\db\Migration; use Da\User\Helper\MigrationHelper; +use yii\db\Migration; class m000000_000006_add_two_factor_fields extends Migration { public function safeUp() { $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() diff --git a/src/User/Model/User.php b/src/User/Model/User.php index c029708..0581719 100644 --- a/src/User/Model/User.php +++ b/src/User/Model/User.php @@ -248,7 +248,7 @@ class User extends ActiveRecord implements IdentityInterface // two factor auth rules 'twoFactorSecretTrim' => ['auth_tf_key', 'trim'], 'twoFactorSecretLength' => ['auth_tf_key', 'string', 'max' => 16], - 'twoFactorEnabledNumber' => ['auth_tf_enabled', 'integer'] + 'twoFactorEnabledNumber' => ['auth_tf_enabled', 'boolean'] ]; }