修改了系统配置的参数
This commit is contained in:
parent
b70b07c8be
commit
b516faae33
@ -14,7 +14,7 @@ import java.util.Map;
|
||||
**/
|
||||
public interface ISystemConfigManager {
|
||||
|
||||
Map<String, Object> getConfig();
|
||||
Map<String, String> getConfig();
|
||||
|
||||
void refreshConfig();
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.common.component;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.manager.IAppManager;
|
||||
import ink.wgink.pojo.app.AppToken;
|
||||
import ink.wgink.pojo.app.AppTokenUser;
|
||||
@ -12,6 +13,7 @@ import ink.wgink.pojo.dtos.group.GroupSimpleDTO;
|
||||
import ink.wgink.pojo.dtos.position.PositionSimpleDTO;
|
||||
import ink.wgink.pojo.dtos.role.RoleSimpleDTO;
|
||||
import ink.wgink.util.ReflectUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@ -197,4 +199,35 @@ public class SecurityComponent {
|
||||
return appToken.getAppTokenUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是管理员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isAdmin() {
|
||||
return isAdmin(listRoleIds());
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是管理员
|
||||
*
|
||||
* @param roleIds
|
||||
* @return
|
||||
*/
|
||||
public boolean isAdmin(List<String> roleIds) {
|
||||
String username = getCurrentUsername();
|
||||
if (StringUtils.equals(username, ISystemConstant.ADMIN)) {
|
||||
return true;
|
||||
}
|
||||
if (roleIds == null || roleIds.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (String roleId : roleIds) {
|
||||
if (StringUtils.equals(roleId, ISystemConstant.ADMIN)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,11 +41,11 @@ public abstract class BaseAuthenticationProcessingFilter extends AbstractAuthent
|
||||
* @param request
|
||||
*/
|
||||
protected void checkVerificationCode(HttpServletRequest request) {
|
||||
Map<String, Object> config = ConfigManager.getInstance().getConfig();
|
||||
Map<String, String> config = ConfigManager.getInstance().getConfig();
|
||||
if (config.get(ISystemConstant.VERIFICATION_CODE) == null) {
|
||||
return;
|
||||
}
|
||||
if (!StringUtils.equals(ISystemConstant.IS_TRUE, config.get(ISystemConstant.VERIFICATION_CODE).toString())) {
|
||||
if (!StringUtils.equals(ISystemConstant.IS_TRUE, config.get(ISystemConstant.VERIFICATION_CODE))) {
|
||||
return;
|
||||
}
|
||||
String verificationCode = request.getParameter(ISystemConstant.VERIFICATION_CODE);
|
||||
|
@ -19,7 +19,6 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -61,25 +60,25 @@ public class IndexRouteController {
|
||||
ModelAndView mv = new ModelAndView("default-main");
|
||||
UserInfoBO userInfoBO = securityComponent.getCurrentUser();
|
||||
mv.addObject("userUsername", userInfoBO.getUserUsername());
|
||||
Map<String, Object> config = ConfigManager.getInstance().getConfig();
|
||||
Map<String, String> config = ConfigManager.getInstance().getConfig();
|
||||
// 先加载系统短标题,没有加载主标题,没有加载配置文件系统标题
|
||||
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_SHORT_TITLE)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SHORT_TITLE).toString())) {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, config.get(IUserCenterConst.SYSTEM_SHORT_TITLE).toString());
|
||||
} else if(!Objects.isNull(config.get(IUserCenterConst.SYSTEM_TITLE)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_TITLE).toString())) {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, config.get(IUserCenterConst.SYSTEM_TITLE).toString());
|
||||
if (!StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SHORT_TITLE))) {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, config.get(IUserCenterConst.SYSTEM_SHORT_TITLE));
|
||||
} else if(!StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_TITLE))) {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, config.get(IUserCenterConst.SYSTEM_TITLE));
|
||||
} else {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, serverProperties.getSystemTitle());
|
||||
}
|
||||
// 系统短LOGO
|
||||
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_SHORT_LOGO)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SHORT_LOGO).toString())) {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_LOGO, config.get(IUserCenterConst.SYSTEM_SHORT_LOGO).toString());
|
||||
if (!StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SHORT_LOGO))) {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_LOGO, config.get(IUserCenterConst.SYSTEM_SHORT_LOGO));
|
||||
} else {
|
||||
mv.addObject(IUserCenterConst.SYSTEM_SHORT_LOGO, "");
|
||||
}
|
||||
mv.addObject("ws", serverProperties.getWs());
|
||||
// 菜单模式
|
||||
if (!Objects.isNull(config.get(IUserCenterConst.MENU_MODE)) && !StringUtils.isBlank(config.get(IUserCenterConst.MENU_MODE).toString())) {
|
||||
mv.addObject(IUserCenterConst.MENU_MODE, config.get(IUserCenterConst.MENU_MODE).toString());
|
||||
if (!StringUtils.isBlank(config.get(IUserCenterConst.MENU_MODE))) {
|
||||
mv.addObject(IUserCenterConst.MENU_MODE, config.get(IUserCenterConst.MENU_MODE));
|
||||
}
|
||||
if (menuBaseService != null) {
|
||||
List<MenuDTO> menus;
|
||||
|
@ -49,7 +49,7 @@ public class OAuthRouteController {
|
||||
@GetMapping("login")
|
||||
public ModelAndView login(HttpServletRequest request) {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
Map<String, Object> pageParams = oAuthService.getPageParams(request);
|
||||
Map<String, String> pageParams = oAuthService.getPageParams(request);
|
||||
mv.addObject(IUserCenterConst.PAGE_PARAMS, pageParams);
|
||||
mv.addObject(IUserCenterConst.CUSTOM_LOGIN_FORM, loginFormService.getActive());
|
||||
mv.setViewName("login");
|
||||
|
@ -26,7 +26,7 @@ public class ConfigManager implements ISystemConfigManager {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ConfigManager.class);
|
||||
private static ConfigManager configManager = ConfigManagerBuilder.configManager;
|
||||
private IConfigDao configDao;
|
||||
private Map<String, Object> config;
|
||||
private Map<String, String> config;
|
||||
public static final String SYSTEM_LICENSE = "systemLicense";
|
||||
public static final String CONFIG_KEY = "configKey";
|
||||
public static final String CONFIG_VALUE = "configValue";
|
||||
@ -44,7 +44,7 @@ public class ConfigManager implements ISystemConfigManager {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getConfig() {
|
||||
public Map<String, String> getConfig() {
|
||||
if (config == null) {
|
||||
refreshConfig();
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ import java.util.Map;
|
||||
*/
|
||||
public interface IOAuthService {
|
||||
|
||||
Map<String, Object> getPageParams(HttpServletRequest request);
|
||||
Map<String, String> getPageParams(HttpServletRequest request);
|
||||
}
|
||||
|
@ -29,11 +29,13 @@ public class OAuthServiceImpl implements IOAuthService {
|
||||
private BaseProperties baseProperties;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getPageParams(HttpServletRequest request) {
|
||||
Map<String, Object> config = ConfigManager.getInstance().getConfig();
|
||||
Map<String, Object> pageParams = new HashMap<>(16);
|
||||
pageParams.put(IUserCenterConst.ERROR_MESSAGE, request.getSession().getAttribute(IUserCenterConst.ERROR_MESSAGE));
|
||||
pageParams.put(IUserCenterConst.LOGIN_USERNAME, request.getSession().getAttribute(IUserCenterConst.LOGIN_USERNAME));
|
||||
public Map<String, String> getPageParams(HttpServletRequest request) {
|
||||
Map<String, String> config = ConfigManager.getInstance().getConfig();
|
||||
Map<String, String> pageParams = new HashMap<>(16);
|
||||
Object errorMessage = request.getSession().getAttribute(IUserCenterConst.ERROR_MESSAGE);
|
||||
Object loginUsername = request.getSession().getAttribute(IUserCenterConst.LOGIN_USERNAME);
|
||||
pageParams.put(IUserCenterConst.ERROR_MESSAGE, errorMessage == null ? null : errorMessage.toString());
|
||||
pageParams.put(IUserCenterConst.LOGIN_USERNAME, loginUsername == null ? null : loginUsername.toString());
|
||||
// 服务地址
|
||||
pageParams.put(IUserCenterConst.SERVER_URL, serverProperties.getUrl());
|
||||
// 系统LOGO
|
||||
@ -43,11 +45,11 @@ public class OAuthServiceImpl implements IOAuthService {
|
||||
// 系统标题
|
||||
pageParams.put(IUserCenterConst.SYSTEM_TITLE, config.isEmpty() ? null : config.get(IUserCenterConst.SYSTEM_TITLE));
|
||||
// 系统标题大小,默认26
|
||||
pageParams.put(IUserCenterConst.SYSTEM_TITLE_SIZE, config.isEmpty() ? null : Integer.parseInt(config.get(IUserCenterConst.SYSTEM_TITLE_SIZE).toString()));
|
||||
pageParams.put(IUserCenterConst.SYSTEM_TITLE_SIZE, config.isEmpty() ? null : config.get(IUserCenterConst.SYSTEM_TITLE_SIZE));
|
||||
// 系统子标题
|
||||
pageParams.put(IUserCenterConst.SYSTEM_SUB_TITLE, config.isEmpty() ? null : config.get(IUserCenterConst.SYSTEM_SUB_TITLE));
|
||||
// 系统子标题大小,默认16
|
||||
pageParams.put(IUserCenterConst.SYSTEM_SUB_TITLE_SIZE, config.isEmpty() ? null : Integer.parseInt(config.get(IUserCenterConst.SYSTEM_SUB_TITLE_SIZE).toString()));
|
||||
pageParams.put(IUserCenterConst.SYSTEM_SUB_TITLE_SIZE, config.isEmpty() ? null : config.get(IUserCenterConst.SYSTEM_SUB_TITLE_SIZE));
|
||||
// 版权年份
|
||||
pageParams.put(IUserCenterConst.COPY_RIGHT_YEAR, config.isEmpty() ? null : config.get(IUserCenterConst.COPY_RIGHT_YEAR));
|
||||
// 版权所属
|
||||
|
@ -112,10 +112,10 @@ public class UserDetailServiceImpl implements UserDetailsService, IUserDetailChe
|
||||
if (StringUtils.equals(userPO.getUserUsername(), ISystemConstant.ADMIN)) {
|
||||
return true;
|
||||
}
|
||||
Map<String, Object> config = ConfigManager.getInstance().getConfig();
|
||||
Object passwordValidity = config.get("passwordValidity");
|
||||
Map<String, String> config = ConfigManager.getInstance().getConfig();
|
||||
String passwordValidity = config.get("passwordValidity");
|
||||
// 自定义密码有效期
|
||||
if (passwordValidity != null && StringUtils.equals(passwordValidity.toString(), "custom")) {
|
||||
if (StringUtils.equals(passwordValidity, "custom")) {
|
||||
Object passwordValidityDays = config.get("passwordValidityDays");
|
||||
int validityDays = passwordValidityDays == null ? 0 : (Integer) passwordValidityDays;
|
||||
if (validityDays <= 0) {
|
||||
|
@ -35,18 +35,12 @@ public class OAuth2ClientDTO extends OAuth2ClientSimpleDTO {
|
||||
private String menuId;
|
||||
@ApiModelProperty(name = "menuName", value = "菜单名称")
|
||||
private String menuName;
|
||||
@ApiModelProperty(name = "environment", value = "系统环境")
|
||||
private String environment;
|
||||
@ApiModelProperty(name = "systemType", value = "系统类型")
|
||||
private String systemType;
|
||||
@ApiModelProperty(name = "systemState", value = "系统状态")
|
||||
private String systemState;
|
||||
@ApiModelProperty(name = "expireTime", value = "系统到期时间")
|
||||
private String expireTime;
|
||||
@ApiModelProperty(name = "systemSummary", value = "系统介绍")
|
||||
private String systemSummary;
|
||||
@ApiModelProperty(name = "systemIcon", value = "系统图标")
|
||||
private String systemIcon;
|
||||
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||
private String gmtCreate;
|
||||
|
||||
@ -138,14 +132,6 @@ public class OAuth2ClientDTO extends OAuth2ClientSimpleDTO {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
public String getEnvironment() {
|
||||
return environment == null ? "" : environment.trim();
|
||||
}
|
||||
|
||||
public void setEnvironment(String environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public String getSystemType() {
|
||||
return systemType == null ? "" : systemType.trim();
|
||||
}
|
||||
@ -170,22 +156,6 @@ public class OAuth2ClientDTO extends OAuth2ClientSimpleDTO {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public String getSystemSummary() {
|
||||
return systemSummary == null ? "" : systemSummary.trim();
|
||||
}
|
||||
|
||||
public void setSystemSummary(String systemSummary) {
|
||||
this.systemSummary = systemSummary;
|
||||
}
|
||||
|
||||
public String getSystemIcon() {
|
||||
return systemIcon == null ? "" : systemIcon.trim();
|
||||
}
|
||||
|
||||
public void setSystemIcon(String systemIcon) {
|
||||
this.systemIcon = systemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
@ -221,18 +191,12 @@ public class OAuth2ClientDTO extends OAuth2ClientSimpleDTO {
|
||||
.append("\"").append(menuId).append("\"");
|
||||
sb.append(",\"menuName\":")
|
||||
.append("\"").append(menuName).append("\"");
|
||||
sb.append(",\"environment\":")
|
||||
.append("\"").append(environment).append("\"");
|
||||
sb.append(",\"systemType\":")
|
||||
.append("\"").append(systemType).append("\"");
|
||||
sb.append(",\"systemState\":")
|
||||
.append("\"").append(systemState).append("\"");
|
||||
sb.append(",\"expireTime\":")
|
||||
.append("\"").append(expireTime).append("\"");
|
||||
sb.append(",\"systemSummary\":")
|
||||
.append("\"").append(systemSummary).append("\"");
|
||||
sb.append(",\"systemIcon\":")
|
||||
.append("\"").append(systemIcon).append("\"");
|
||||
sb.append(",\"gmtCreate\":")
|
||||
.append("\"").append(gmtCreate).append("\"");
|
||||
sb.append('}');
|
||||
|
@ -25,6 +25,12 @@ public class OAuth2ClientSimpleDTO implements Serializable {
|
||||
private String clientName;
|
||||
@ApiModelProperty(name = "webServerRedirectUri", value = "重定向链接")
|
||||
private String webServerRedirectUri;
|
||||
@ApiModelProperty(name = "environment", value = "系统环境")
|
||||
private String environment;
|
||||
@ApiModelProperty(name = "systemSummary", value = "系统介绍")
|
||||
private String systemSummary;
|
||||
@ApiModelProperty(name = "systemIcon", value = "系统图标")
|
||||
private String systemIcon;
|
||||
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||
private String gmtCreate;
|
||||
|
||||
@ -52,6 +58,30 @@ public class OAuth2ClientSimpleDTO implements Serializable {
|
||||
this.webServerRedirectUri = webServerRedirectUri;
|
||||
}
|
||||
|
||||
public String getEnvironment() {
|
||||
return environment == null ? "" : environment.trim();
|
||||
}
|
||||
|
||||
public void setEnvironment(String environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
public String getSystemSummary() {
|
||||
return systemSummary == null ? "" : systemSummary.trim();
|
||||
}
|
||||
|
||||
public void setSystemSummary(String systemSummary) {
|
||||
this.systemSummary = systemSummary;
|
||||
}
|
||||
|
||||
public String getSystemIcon() {
|
||||
return systemIcon == null ? "" : systemIcon.trim();
|
||||
}
|
||||
|
||||
public void setSystemIcon(String systemIcon) {
|
||||
this.systemIcon = systemIcon;
|
||||
}
|
||||
|
||||
public String getGmtCreate() {
|
||||
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||
}
|
||||
@ -69,6 +99,12 @@ public class OAuth2ClientSimpleDTO implements Serializable {
|
||||
.append(clientName).append('\"');
|
||||
sb.append(",\"webServerRedirectUri\":\"")
|
||||
.append(webServerRedirectUri).append('\"');
|
||||
sb.append(",\"environment\":\"")
|
||||
.append(environment).append('\"');
|
||||
sb.append(",\"systemSummary\":\"")
|
||||
.append(systemSummary).append('\"');
|
||||
sb.append(",\"systemIcon\":\"")
|
||||
.append(systemIcon).append('\"');
|
||||
sb.append(",\"gmtCreate\":\"")
|
||||
.append(gmtCreate).append('\"');
|
||||
sb.append('}');
|
||||
|
@ -109,6 +109,30 @@ public interface IOAuth2ClientService {
|
||||
*/
|
||||
List<OAuth2ClientSimpleDTO> listSimple(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* Oauth客户端列表(简单)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OAuth2ClientSimpleDTO> listSimple();
|
||||
|
||||
/**
|
||||
* Oauth客户端列表(简单)
|
||||
*
|
||||
* @param menuIds
|
||||
* @return
|
||||
*/
|
||||
List<OAuth2ClientSimpleDTO> listSimpleByMenuIds(List<String> menuIds);
|
||||
|
||||
/**
|
||||
* Oauth客户端列表(简单)
|
||||
*
|
||||
* @param rootMenuIds
|
||||
* @param environment
|
||||
* @return
|
||||
*/
|
||||
List<OAuth2ClientSimpleDTO> listSimpleByMenuIdsAndEnvironment(List<String> rootMenuIds, String environment);
|
||||
|
||||
/**
|
||||
* easyUI Oauth客户端列表
|
||||
*
|
||||
|
@ -117,6 +117,27 @@ public class OAuth2ClientServiceImpl extends DefaultBaseService implements IOAut
|
||||
return oauth2ClientDao.listSimple(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OAuth2ClientSimpleDTO> listSimple() {
|
||||
Map<String, Object> params = getHashMap(0);
|
||||
return listSimple(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OAuth2ClientSimpleDTO> listSimpleByMenuIds(List<String> menuIds) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("menuIds", menuIds);
|
||||
return listSimple(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OAuth2ClientSimpleDTO> listSimpleByMenuIdsAndEnvironment(List<String> menuIds, String environment) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("menuIds", menuIds);
|
||||
params.put("environment", environment);
|
||||
return listSimple(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<OAuth2ClientDTO>> listPage(ListPage page) throws SearchException {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
|
@ -8,6 +8,9 @@
|
||||
<id property="clientId" column="client_id"/>
|
||||
<result property="clientName" column="client_name"/>
|
||||
<result property="webServerRedirectUri" column="web_server_redirect_uri"/>
|
||||
<result property="environment" column="environment"/>
|
||||
<result property="systemSummary" column="system_summary"/>
|
||||
<result property="systemIcon" column="system_icon"/>
|
||||
<result property="gmtCreate" column="gmt_create"/>
|
||||
</resultMap>
|
||||
|
||||
@ -23,7 +26,7 @@
|
||||
<result property="autoapprove" column="autoapprove"/>
|
||||
<result property="menuId" column="menu_id"/>
|
||||
<result property="menuName" column="menu_name"/>
|
||||
<result property="environment" column="menu_name"/>
|
||||
<result property="environment" column="environment"/>
|
||||
<result property="systemType" column="system_type"/>
|
||||
<result property="systemState" column="system_state"/>
|
||||
<result property="expireTime" column="expire_time"/>
|
||||
@ -47,7 +50,7 @@
|
||||
<result property="additionalInformation" column="additional_information"/>
|
||||
<result property="autoapprove" column="autoapprove"/>
|
||||
<result property="menuId" column="menu_id"/>
|
||||
<result property="environment" column="menu_name"/>
|
||||
<result property="environment" column="environment"/>
|
||||
<result property="systemType" column="system_type"/>
|
||||
<result property="systemState" column="system_state"/>
|
||||
<result property="expireTime" column="expire_time"/>
|
||||
@ -293,11 +296,25 @@
|
||||
t1.client_id,
|
||||
t1.client_name,
|
||||
t1.web_server_redirect_uri,
|
||||
t1.environment,
|
||||
t1.system_summary,
|
||||
t1.system_icon,
|
||||
LEFT(t1.gmt_create, 10) gmt_create
|
||||
FROM
|
||||
oauth_client_details t1
|
||||
WHERE
|
||||
t1.is_delete = 0
|
||||
<if test="environment != null and environment != ''">
|
||||
AND
|
||||
t1.environment = #{environment}
|
||||
</if>
|
||||
<if test="menuIds != null and menuIds.size > 0">
|
||||
AND
|
||||
t1.menu_id IN
|
||||
<foreach collection="menuIds" index="index" open="(" separator="," close=")">
|
||||
#{menuIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- Oauth客户端详情 -->
|
||||
|
@ -138,7 +138,7 @@
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="systemIconRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
|
@ -138,7 +138,7 @@
|
||||
{{# for(var i = 0, item = files[i]; item = files[i++];) { }}
|
||||
<div class="upload-image-box">
|
||||
<span class="upload-image-span">
|
||||
<img src="route/file/downloadfile/false/{{item.fileId}}" align="加载失败">
|
||||
<img src="route/file/download/false/{{item.fileId}}" align="加载失败">
|
||||
</span>
|
||||
<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="{{item.fileId}}" data-name="{{fileName}}" lay-filter="systemIconRemoveFile">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
|
@ -135,9 +135,9 @@ public class UserController extends DefaultBaseController {
|
||||
* @param config
|
||||
* @param updatePasswordVO
|
||||
*/
|
||||
private void checkUpdatePasswordParams(Map<String, Object> config, UpdatePasswordVO updatePasswordVO) {
|
||||
private void checkUpdatePasswordParams(Map<String, String> config, UpdatePasswordVO updatePasswordVO) {
|
||||
if (config.get(IUserService.PASSWORD_STRENGTH) != null) {
|
||||
String passwordStrength = config.get(IUserService.PASSWORD_STRENGTH).toString();
|
||||
String passwordStrength = config.get(IUserService.PASSWORD_STRENGTH);
|
||||
if (StringUtils.equals(IUserService.PASSWORD_STRENGTH_MIDDLE, passwordStrength) && !RegexUtil.isPasswordMiddle(updatePasswordVO.getNewPassword())) {
|
||||
throw new ParamsException(String.format("密码应该%d到%d位,包含数字、字母、特殊字符,其中的任意两种,特殊字符包括%s", RegexUtil.PASSWORD_LENGTH_MIN, RegexUtil.PASSWORD_LENGTH_MAX, RegexUtil.SPECIAL_CHARACTERS));
|
||||
} else if (StringUtils.equals(IUserService.PASSWORD_STRENGTH_STRONG, passwordStrength) && !RegexUtil.isPasswordStrong(updatePasswordVO.getNewPassword())) {
|
||||
|
@ -64,9 +64,9 @@ public class UserResourceController extends DefaultBaseController {
|
||||
* @param config
|
||||
* @param updatePasswordVO
|
||||
*/
|
||||
private void checkUpdatePasswordParams(Map<String, Object> config, UpdatePasswordVO updatePasswordVO) {
|
||||
private void checkUpdatePasswordParams(Map<String, String> config, UpdatePasswordVO updatePasswordVO) {
|
||||
if (config.get(IUserService.PASSWORD_STRENGTH) != null) {
|
||||
String passwordStrength = config.get(IUserService.PASSWORD_STRENGTH).toString();
|
||||
String passwordStrength = config.get(IUserService.PASSWORD_STRENGTH);
|
||||
if (StringUtils.equals(IUserService.PASSWORD_STRENGTH_MIDDLE, passwordStrength) && !RegexUtil.isPasswordMiddle(updatePasswordVO.getNewPassword())) {
|
||||
throw new ParamsException(String.format("密码应该%d到%d位,包含数字、字母、特殊字符,其中的任意两种,特殊字符包括%s", RegexUtil.PASSWORD_LENGTH_MIN, RegexUtil.PASSWORD_LENGTH_MAX, RegexUtil.SPECIAL_CHARACTERS));
|
||||
} else if (StringUtils.equals(IUserService.PASSWORD_STRENGTH_STRONG, passwordStrength) && !RegexUtil.isPasswordStrong(updatePasswordVO.getNewPassword())) {
|
||||
|
@ -489,18 +489,18 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
if (systemConfigManager == null) {
|
||||
return new SuccessResultData<>(PASSWORD_OK);
|
||||
}
|
||||
Map<String, Object> config = systemConfigManager.getConfig();
|
||||
Map<String, String> config = systemConfigManager.getConfig();
|
||||
String passwordValidity = PASSWORD_VALIDITY_CUSTOM;
|
||||
if (config.get(PASSWORD_VALIDITY) != null && !StringUtils.isBlank(config.get(PASSWORD_VALIDITY).toString())) {
|
||||
passwordValidity = config.get(PASSWORD_VALIDITY).toString();
|
||||
if (!StringUtils.isBlank(config.get(PASSWORD_VALIDITY))) {
|
||||
passwordValidity = config.get(PASSWORD_VALIDITY);
|
||||
}
|
||||
// 密码永不过期
|
||||
if (StringUtils.equals(PASSWORD_VALIDITY_NONE, passwordValidity)) {
|
||||
return new SuccessResultData<>(PASSWORD_OK);
|
||||
}
|
||||
String firstLoginChangePassword = FIRST_LOGIN_CHANGE_PASSWORD_CLOSE;
|
||||
if (config.get(FIRST_LOGIN_CHANGE_PASSWORD) != null && !StringUtils.isBlank(config.get(FIRST_LOGIN_CHANGE_PASSWORD).toString())) {
|
||||
firstLoginChangePassword = config.get(FIRST_LOGIN_CHANGE_PASSWORD).toString();
|
||||
if (!StringUtils.isBlank(config.get(FIRST_LOGIN_CHANGE_PASSWORD))) {
|
||||
firstLoginChangePassword = config.get(FIRST_LOGIN_CHANGE_PASSWORD);
|
||||
}
|
||||
UserPO userPO = getPO(securityComponent.getCurrentUser().getUserId());
|
||||
String gmtCreate = userPO.getGmtCreate();
|
||||
@ -515,8 +515,8 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
}
|
||||
// 密码有效时间
|
||||
int passwordValidityDays = 90;
|
||||
if (config.get(PASSWORD_VALIDITY_DAYS) != null && StringUtils.isBlank(config.get(PASSWORD_VALIDITY_DAYS).toString())) {
|
||||
passwordValidityDays = Integer.parseInt(config.get(PASSWORD_VALIDITY_DAYS).toString());
|
||||
if (StringUtils.isBlank(config.get(PASSWORD_VALIDITY_DAYS))) {
|
||||
passwordValidityDays = Integer.parseInt(config.get(PASSWORD_VALIDITY_DAYS));
|
||||
}
|
||||
if (gmtPasswordModifiedDateTime == null) {
|
||||
return new SuccessResultData<>(PASSWORD_CHANGE);
|
||||
@ -529,8 +529,8 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
}
|
||||
// 提醒修改密码时间
|
||||
int changePasswordNoticeDays = 14;
|
||||
if (config.get(CHANGE_PASSWORD_NOTICE_DAYS) != null && StringUtils.isBlank(config.get(CHANGE_PASSWORD_NOTICE_DAYS).toString())) {
|
||||
changePasswordNoticeDays = Integer.parseInt(config.get(CHANGE_PASSWORD_NOTICE_DAYS).toString());
|
||||
if (!StringUtils.isBlank(config.get(CHANGE_PASSWORD_NOTICE_DAYS))) {
|
||||
changePasswordNoticeDays = Integer.parseInt(config.get(CHANGE_PASSWORD_NOTICE_DAYS));
|
||||
}
|
||||
if (changePasswordNoticeDays >= passwordValidityDays) {
|
||||
return new SuccessResultData<>(PASSWORD_OK);
|
||||
|
Loading…
Reference in New Issue
Block a user