Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
c0355a0f
Commit
c0355a0f
authored
May 23, 2025
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
账号密码支持自定义更新周期
parent
8ff01355
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
7 deletions
+34
-7
SysLoginController.java
...a/com/ruoyi/web/controller/system/SysLoginController.java
+20
-0
user.js
ruoyi-ui/src/store/modules/user.js
+6
-0
ry_20250522.sql
sql/ry_20250522.sql
+8
-7
No files found.
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
View file @
c0355a0f
...
@@ -15,7 +15,9 @@ import com.ruoyi.common.core.domain.entity.SysUser;
...
@@ -15,7 +15,9 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import
com.ruoyi.common.core.domain.model.LoginBody
;
import
com.ruoyi.common.core.domain.model.LoginBody
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.domain.model.LoginUser
;
import
com.ruoyi.common.core.text.Convert
;
import
com.ruoyi.common.core.text.Convert
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.framework.web.service.SysLoginService
;
import
com.ruoyi.framework.web.service.SysLoginService
;
import
com.ruoyi.framework.web.service.SysPermissionService
;
import
com.ruoyi.framework.web.service.SysPermissionService
;
import
com.ruoyi.framework.web.service.TokenService
;
import
com.ruoyi.framework.web.service.TokenService
;
...
@@ -86,6 +88,7 @@ public class SysLoginController
...
@@ -86,6 +88,7 @@ public class SysLoginController
ajax
.
put
(
"roles"
,
roles
);
ajax
.
put
(
"roles"
,
roles
);
ajax
.
put
(
"permissions"
,
permissions
);
ajax
.
put
(
"permissions"
,
permissions
);
ajax
.
put
(
"isDefaultModifyPwd"
,
initPasswordIsModify
(
user
.
getPwdUpdateDate
()));
ajax
.
put
(
"isDefaultModifyPwd"
,
initPasswordIsModify
(
user
.
getPwdUpdateDate
()));
ajax
.
put
(
"isPasswordExpired"
,
passwordIsExpiration
(
user
.
getPwdUpdateDate
()));
return
ajax
;
return
ajax
;
}
}
...
@@ -108,4 +111,21 @@ public class SysLoginController
...
@@ -108,4 +111,21 @@ public class SysLoginController
Integer
initPasswordModify
=
Convert
.
toInt
(
configService
.
selectConfigByKey
(
"sys.account.initPasswordModify"
));
Integer
initPasswordModify
=
Convert
.
toInt
(
configService
.
selectConfigByKey
(
"sys.account.initPasswordModify"
));
return
initPasswordModify
!=
null
&&
initPasswordModify
==
1
&&
pwdUpdateDate
==
null
;
return
initPasswordModify
!=
null
&&
initPasswordModify
==
1
&&
pwdUpdateDate
==
null
;
}
}
// 检查密码是否过期
public
boolean
passwordIsExpiration
(
Date
pwdUpdateDate
)
{
Integer
passwordValidateDays
=
Convert
.
toInt
(
configService
.
selectConfigByKey
(
"sys.account.passwordValidateDays"
));
if
(
passwordValidateDays
!=
null
&&
passwordValidateDays
>
0
)
{
if
(
StringUtils
.
isNull
(
pwdUpdateDate
))
{
// 如果从未修改过初始密码,直接提醒过期
return
true
;
}
Date
nowDate
=
DateUtils
.
getNowDate
();
return
DateUtils
.
differentDaysByMillisecond
(
nowDate
,
pwdUpdateDate
)
>
passwordValidateDays
;
}
return
false
;
}
}
}
ruoyi-ui/src/store/modules/user.js
View file @
c0355a0f
...
@@ -83,6 +83,12 @@ const user = {
...
@@ -83,6 +83,12 @@ const user = {
router
.
push
({
name
:
'Profile'
,
params
:
{
activeTab
:
'resetPwd'
}
})
router
.
push
({
name
:
'Profile'
,
params
:
{
activeTab
:
'resetPwd'
}
})
}).
catch
(()
=>
{})
}).
catch
(()
=>
{})
}
}
/* 过期密码提示 */
if
(
!
res
.
isDefaultModifyPwd
&&
res
.
isPasswordExpired
)
{
MessageBox
.
confirm
(
'您的密码已过期,请尽快修改密码!'
,
'安全提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
router
.
push
({
name
:
'Profile'
,
params
:
{
activeTab
:
'resetPwd'
}
})
}).
catch
(()
=>
{})
}
resolve
(
res
)
resolve
(
res
)
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
reject
(
error
)
reject
(
error
)
...
...
sql/ry_20250522.sql
View file @
c0355a0f
...
@@ -545,13 +545,14 @@ create table sys_config (
...
@@ -545,13 +545,14 @@ create table sys_config (
primary
key
(
config_id
)
primary
key
(
config_id
)
)
engine
=
innodb
auto_increment
=
100
comment
=
'参数配置表'
;
)
engine
=
innodb
auto_increment
=
100
comment
=
'参数配置表'
;
insert
into
sys_config
values
(
1
,
'主框架页-默认皮肤样式名称'
,
'sys.index.skinName'
,
'skin-blue'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'
);
insert
into
sys_config
values
(
1
,
'主框架页-默认皮肤样式名称'
,
'sys.index.skinName'
,
'skin-blue'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'
);
insert
into
sys_config
values
(
2
,
'用户管理-账号初始密码'
,
'sys.user.initPassword'
,
'123456'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'初始化密码 123456'
);
insert
into
sys_config
values
(
2
,
'用户管理-账号初始密码'
,
'sys.user.initPassword'
,
'123456'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'初始化密码 123456'
);
insert
into
sys_config
values
(
3
,
'主框架页-侧边栏主题'
,
'sys.index.sideTheme'
,
'theme-dark'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'深色主题theme-dark,浅色主题theme-light'
);
insert
into
sys_config
values
(
3
,
'主框架页-侧边栏主题'
,
'sys.index.sideTheme'
,
'theme-dark'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'深色主题theme-dark,浅色主题theme-light'
);
insert
into
sys_config
values
(
4
,
'账号自助-验证码开关'
,
'sys.account.captchaEnabled'
,
'true'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'是否开启验证码功能(true开启,false关闭)'
);
insert
into
sys_config
values
(
4
,
'账号自助-验证码开关'
,
'sys.account.captchaEnabled'
,
'true'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'是否开启验证码功能(true开启,false关闭)'
);
insert
into
sys_config
values
(
5
,
'账号自助-是否开启用户注册功能'
,
'sys.account.registerUser'
,
'false'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'是否开启注册用户功能(true开启,false关闭)'
);
insert
into
sys_config
values
(
5
,
'账号自助-是否开启用户注册功能'
,
'sys.account.registerUser'
,
'false'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'是否开启注册用户功能(true开启,false关闭)'
);
insert
into
sys_config
values
(
6
,
'用户登录-黑名单列表'
,
'sys.login.blackIPList'
,
''
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)'
);
insert
into
sys_config
values
(
6
,
'用户登录-黑名单列表'
,
'sys.login.blackIPList'
,
''
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)'
);
insert
into
sys_config
values
(
7
,
'用户管理-初始密码修改策略'
,
'sys.account.initPasswordModify'
,
'1'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'0:初始密码修改策略关闭,没有任何提示,1:提醒用户,如果未修改初始密码,则在登录时就会提醒修改密码对话框'
);
insert
into
sys_config
values
(
7
,
'用户管理-初始密码修改策略'
,
'sys.account.initPasswordModify'
,
'1'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'0:初始密码修改策略关闭,没有任何提示,1:提醒用户,如果未修改初始密码,则在登录时就会提醒修改密码对话框'
);
insert
into
sys_config
values
(
8
,
'用户管理-账号密码更新周期'
,
'sys.account.passwordValidateDays'
,
'0'
,
'Y'
,
'admin'
,
sysdate
(),
''
,
null
,
'密码更新周期(填写数字,数据初始化值为0不限制,若修改必须为大于0小于365的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框'
);
-- ----------------------------
-- ----------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment