Add two-factor api

This commit is contained in:
2024-02-29 19:33:26 +08:00
parent 376ef81950
commit b52ce7f5e8
31 changed files with 709 additions and 25 deletions

View File

@@ -69,9 +69,11 @@ insert into t_s_power (id, type_id)
(1530101, 4),
(1530102, 4),
(1530103, 4),
(1530104, 4),
(1530301, 4),
(1530302, 4),
(1530303, 4),
(1530304, 4),
(1540101, 4),
(1540102, 4),
(1540103, 4),
@@ -167,9 +169,11 @@ insert into t_s_operation(id, name, code, func_id)
(1530101, '基础', 'system:settings:query:base', 1530100),
(1530102, '邮件', 'system:settings:query:mail', 1530100),
(1530103, '敏感词', 'system:settings:query:sensitive', 1530100),
(1530104, '二步验证', 'system:settings:query:two-factor', 1530100),
(1530301, '基础', 'system:settings:modify:base', 1530300),
(1530302, '邮件', 'system:settings:modify:mail', 1530300),
(1530303, '敏感词', 'system:settings:modify:sensitive', 1530300),
(1530304, '二步验证', 'system:settings:modify:two-factor', 1530300),
(1540101, '类别', 'system:tool:query:category', 1540100),
(1540102, '基板', 'system:tool:query:base', 1540100),
(1540103, '模板', 'system:tool:query:template', 1540100),

View File

@@ -5,6 +5,7 @@ create table if not exists t_s_user
id bigint not null primary key,
username varchar(20) not null comment '用户名',
password char(70) not null comment '密码',
two_factor varchar(40) null comment '二步验证',
verify varchar(144) null comment '验证邮箱',
forget varchar(144) null comment '忘记密码',
locking int not null comment '锁定',
@@ -20,6 +21,7 @@ create table if not exists t_s_user
deleted bigint not null default 0,
version int not null default 0,
constraint t_s_user_unique_username unique (username, deleted),
constraint t_s_user_unique_two_factor unique (two_factor, deleted),
constraint t_s_user_unique_verify unique (verify, deleted),
constraint t_s_user_unique_forget unique (forget, deleted)
) comment '系统-用户表';

View File

@@ -5,6 +5,7 @@
select t_s_user.id as user_id,
t_s_user.username as user_username,
t_s_user.password as user_password,
t_s_user.two_factor as user_two_factor,
t_s_user.verify as user_verify,
t_s_user.forget as user_forget,
t_s_user.locking as user_locking,
@@ -61,11 +62,11 @@
</select>
<select id="selectOneWithBasicInfoByUsername" resultMap="userWithInfoMap">
select t_s_user.id as user_id,
t_s_user.username as user_username,
tsui.id as user_info_id,
tsui.nickname as user_info_nickname,
tsui.avatar as user_info_avatar
select t_s_user.id as user_id,
t_s_user.username as user_username,
tsui.id as user_info_id,
tsui.nickname as user_info_nickname,
tsui.avatar as user_info_avatar
from t_s_user
left join (select * from t_s_user_info where deleted = 0) as tsui on t_s_user.id = tsui.user_id
where t_s_user.deleted = 0
@@ -140,6 +141,7 @@
<select id="selectListWithRoleInfoByIds" resultMap="userWithRoleInfoMap">
select t_s_user.id as user_id,
t_s_user.username as user_username,
t_s_user.two_factor as user_two_factor,
t_s_user.verify as user_verify,
t_s_user.forget as user_forget,
t_s_user.locking as user_locking,
@@ -196,6 +198,7 @@
<select id="selectOneWithRoleInfoById" resultMap="userWithRoleInfoMap">
select t_s_user.id as user_id,
t_s_user.username as user_username,
t_s_user.two_factor as user_two_factor,
t_s_user.verify as user_verify,
t_s_user.forget as user_forget,
t_s_user.locking as user_locking,
@@ -303,6 +306,7 @@
<resultMap id="userBaseMap" type="user">
<id property="id" column="user_id"/>
<result property="username" column="user_username"/>
<result property="twoFactor" column="user_two_factor"/>
<result property="verify" column="user_verify"/>
<result property="forget" column="user_forget"/>
<result property="locking" column="user_locking"/>