close #326 fix rule for the user auth_tf_enabled field

This commit is contained in:
tonydspaniard
2019-06-28 23:45:49 +02:00
parent 019660d4f6
commit fc326d0a61
2 changed files with 7 additions and 3 deletions

View File

@ -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()

View File

@ -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']
];
}