1.增加谷歌验证器

This commit is contained in:
2026-06-24 16:25:31 +08:00
parent 5187330c38
commit 3e88a5dd91
21 changed files with 822 additions and 46 deletions

View File

@@ -21,6 +21,8 @@ use support\think\Db;
* @property string $password 密码密文
* @property string $salt 密码盐
* @property string $status 状态:enable=启用,disable=禁用
* @property string $totp_secret TOTP密钥(加密)
* @property int $totp_bind_time TOTP绑定时间
*/
class Admin extends Model
{
@@ -43,8 +45,18 @@ class Admin extends Model
protected array $append = [
'group_arr',
'group_name_arr',
'totp_bound',
];
protected array $hidden = [
'totp_secret',
];
public function getTotpBoundAttr($value, $row): bool
{
return \app\common\library\AdminTotp::isBound($row['totp_secret'] ?? '');
}
public function getGroupArrAttr($value, $row): array
{
return Db::name('admin_group_access')