Skip to content

Commit

Permalink
敏感字段加密
Browse files Browse the repository at this point in the history
  • Loading branch information
nick2wang committed Apr 30, 2022
1 parent a322df7 commit 60f9331
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions sql/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class TwoFactorAuthConfig(models.Model):
('totp', 'Google身份验证器'),
)

username = models.CharField('用户名', max_length=150)
auth_type = models.CharField('认证类型', max_length=16, choices=auth_type_choice)
secret_key = models.CharField('用户密钥', max_length=64, null=True)
qrcode = models.CharField('二维码图片', max_length=128, null=True)
username = fields.EncryptedCharField(verbose_name='用户名', max_length=200)
auth_type = fields.EncryptedCharField(verbose_name='认证类型', max_length=128, choices=auth_type_choice)
secret_key = fields.EncryptedCharField(verbose_name='用户密钥', max_length=256, null=True)
qrcode = fields.EncryptedCharField(verbose_name='二维码图片', max_length=256, null=True)
user = models.OneToOneField(Users, on_delete=models.CASCADE)

def __int__(self):
Expand Down
8 changes: 4 additions & 4 deletions src/init_sql/v1.8.4.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ INSERT INTO auth_permission (name, content_type_id, codename) VALUES ('菜单 Op
-- 新增2fa配置表
CREATE TABLE `2fa_config` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(150) NOT NULL,
`auth_type` varchar(16) NOT NULL,
`secret_key` varchar(64) DEFAULT NULL,
`qrcode` varchar(128) DEFAULT NULL,
`username` varchar(200) NOT NULL,
`auth_type` varchar(128) NOT NULL,
`secret_key` varchar(256) DEFAULT NULL,
`qrcode` varchar(256) DEFAULT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`),
Expand Down

0 comments on commit 60f9331

Please sign in to comment.