Compare commits
10 Commits
0728a04b1b
...
41720e624c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41720e624c | ||
|
|
09f1b3495f | ||
|
|
1a8d111459 | ||
|
|
87d02b0e41 | ||
|
|
7da12b0c07 | ||
|
|
dbe9834e4c | ||
|
|
69aaabd09d | ||
|
|
557efc4d44 | ||
|
|
58f3c43c50 | ||
|
|
d454d9729e |
16
pom.xml
16
pom.xml
@@ -17,27 +17,27 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<spring-boot.version>4.0.3</spring-boot.version>
|
<spring-boot.version>4.0.6</spring-boot.version>
|
||||||
<mybatis-spring-boot.version>4.0.1</mybatis-spring-boot.version>
|
<mybatis-spring-boot.version>4.0.1</mybatis-spring-boot.version>
|
||||||
<druid.version>1.2.28</druid.version>
|
<druid.version>1.2.28</druid.version>
|
||||||
<yauaa.version>8.1.0</yauaa.version>
|
<yauaa.version>8.1.1</yauaa.version>
|
||||||
<kaptcha.version>2.3.3</kaptcha.version>
|
<kaptcha.version>2.3.3</kaptcha.version>
|
||||||
<pagehelper.boot.version>2.1.1</pagehelper.boot.version>
|
<pagehelper.boot.version>4.1.0</pagehelper.boot.version>
|
||||||
<fastjson.version>2.0.61</fastjson.version>
|
<fastjson.version>2.0.62</fastjson.version>
|
||||||
<oshi.version>6.10.0</oshi.version>
|
<oshi.version>7.3.0</oshi.version>
|
||||||
<commons.io.version>2.21.0</commons.io.version>
|
<commons.io.version>2.22.0</commons.io.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
<jaxb-api.version>2.3.1</jaxb-api.version>
|
<jaxb-api.version>2.3.1</jaxb-api.version>
|
||||||
<springdoc.version>3.0.2</springdoc.version>
|
<springdoc.version>3.0.3</springdoc.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 依赖声明 -->
|
<!-- 依赖声明 -->
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- SpringBoot的依赖配置-->
|
<!-- SpringBoot的依赖配置 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public class SysLoginController
|
|||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
|
ajax.put("pwdChrtype", getSysAccountChrtype());
|
||||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||||
return ajax;
|
return ajax;
|
||||||
@@ -105,6 +106,12 @@ public class SysLoginController
|
|||||||
return AjaxResult.success(menuService.buildMenus(menus));
|
return AjaxResult.success(menuService.buildMenus(menus));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户密码自定义配置规则
|
||||||
|
public String getSysAccountChrtype()
|
||||||
|
{
|
||||||
|
return Convert.toStr(configService.selectConfigByKey("sys.account.chrtype"), "0");
|
||||||
|
}
|
||||||
|
|
||||||
// 检查初始密码是否提醒修改
|
// 检查初始密码是否提醒修改
|
||||||
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class SysNoticeController extends BaseController
|
|||||||
* 已读用户列表数据
|
* 已读用户列表数据
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||||
@PostMapping("/readUsers/list")
|
@GetMapping("/readUsers/list")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public TableDataInfo readUsersList(Long noticeId, String searchValue)
|
public TableDataInfo readUsersList(Long noticeId, String searchValue)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,10 +19,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
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;
|
||||||
@@ -128,14 +126,8 @@ public class SysRoleController extends BaseController
|
|||||||
|
|
||||||
if (roleService.updateRole(role) > 0)
|
if (roleService.updateRole(role) > 0)
|
||||||
{
|
{
|
||||||
// 更新缓存用户权限
|
// 刷新所有持有该角色的在线用户权限
|
||||||
LoginUser loginUser = getLoginUser();
|
tokenService.refreshPermissionByRoleId(role.getRoleId(), permissionService);
|
||||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
|
||||||
{
|
|
||||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
|
||||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
|
||||||
tokenService.setLoginUser(loginUser);
|
|
||||||
}
|
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
<!-- JSON工具类 -->
|
<!-- JSON工具类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>tools.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.lang.annotation.Retention;
|
|||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import tools.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.ruoyi.common.config.serializer.SensitiveJsonSerializer;
|
import com.ruoyi.common.config.serializer.SensitiveJsonSerializer;
|
||||||
import com.ruoyi.common.enums.DesensitizedType;
|
import com.ruoyi.common.enums.DesensitizedType;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import com.ruoyi.common.enums.DesensitizedType;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target(ElementType.FIELD)
|
@Target({ ElementType.FIELD, ElementType.METHOD })
|
||||||
@JacksonAnnotationsInside
|
@JacksonAnnotationsInside
|
||||||
@JsonSerialize(using = SensitiveJsonSerializer.class)
|
@JsonSerialize(using = SensitiveJsonSerializer.class)
|
||||||
public @interface Sensitive
|
public @interface Sensitive
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.ruoyi.common.config.serializer;
|
package com.ruoyi.common.config.serializer;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import tools.jackson.core.JacksonException;
|
||||||
import com.fasterxml.jackson.databind.BeanProperty;
|
import tools.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import tools.jackson.databind.BeanProperty;
|
||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
import tools.jackson.databind.DatabindException;
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import tools.jackson.databind.SerializationContext;
|
||||||
import com.fasterxml.jackson.databind.ser.ContextualSerializer;
|
import tools.jackson.databind.ValueSerializer;
|
||||||
|
import tools.jackson.databind.ser.std.StdSerializer;
|
||||||
import com.ruoyi.common.annotation.Sensitive;
|
import com.ruoyi.common.annotation.Sensitive;
|
||||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||||
import com.ruoyi.common.enums.DesensitizedType;
|
import com.ruoyi.common.enums.DesensitizedType;
|
||||||
@@ -18,14 +18,26 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer
|
public class SensitiveJsonSerializer extends StdSerializer<String>
|
||||||
{
|
{
|
||||||
private DesensitizedType desensitizedType;
|
private final DesensitizedType desensitizedType;
|
||||||
|
|
||||||
|
public SensitiveJsonSerializer()
|
||||||
|
{
|
||||||
|
super(String.class);
|
||||||
|
this.desensitizedType = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SensitiveJsonSerializer(DesensitizedType desensitizedType)
|
||||||
|
{
|
||||||
|
super(String.class);
|
||||||
|
this.desensitizedType = desensitizedType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException
|
public void serialize(String value, JsonGenerator gen, SerializationContext ctxt) throws JacksonException
|
||||||
{
|
{
|
||||||
if (desensitization())
|
if (desensitizedType != null && desensitization())
|
||||||
{
|
{
|
||||||
gen.writeString(desensitizedType.desensitizer().apply(value));
|
gen.writeString(desensitizedType.desensitizer().apply(value));
|
||||||
}
|
}
|
||||||
@@ -36,16 +48,14 @@ public class SensitiveJsonSerializer extends JsonSerializer<String> implements C
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property)
|
public ValueSerializer<?> createContextual(SerializationContext ctxt, BeanProperty property) throws DatabindException
|
||||||
throws JsonMappingException
|
|
||||||
{
|
{
|
||||||
Sensitive annotation = property.getAnnotation(Sensitive.class);
|
Sensitive annotation = property.getAnnotation(Sensitive.class);
|
||||||
if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass()))
|
if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass()))
|
||||||
{
|
{
|
||||||
this.desensitizedType = annotation.desensitizedType();
|
return new SensitiveJsonSerializer(annotation.desensitizedType());
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
return prov.findValueSerializer(property.getType(), property);
|
return ctxt.findValueSerializer(property.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class MimeTypeUtils
|
|||||||
// 图片
|
// 图片
|
||||||
"bmp", "gif", "jpg", "jpeg", "png",
|
"bmp", "gif", "jpg", "jpeg", "png",
|
||||||
// word excel powerpoint
|
// word excel powerpoint
|
||||||
"doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
|
"doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt",
|
||||||
// 压缩文件
|
// 压缩文件
|
||||||
"rar", "zip", "gz", "bz2",
|
"rar", "zip", "gz", "bz2",
|
||||||
// 视频格式
|
// 视频格式
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.ruoyi.framework.web.service;
|
package com.ruoyi.framework.web.service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -22,6 +22,7 @@ import com.ruoyi.common.utils.uuid.IdUtils;
|
|||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* token验证处理
|
* token验证处理
|
||||||
@@ -229,4 +230,41 @@ public class TokenService
|
|||||||
{
|
{
|
||||||
return CacheConstants.LOGIN_TOKEN_KEY + uuid;
|
return CacheConstants.LOGIN_TOKEN_KEY + uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色权限变更后,刷新所有持有该角色的在线用户权限
|
||||||
|
*
|
||||||
|
* @param roleId 变更的角色ID
|
||||||
|
* @param permissionService 权限服务
|
||||||
|
*/
|
||||||
|
public void refreshPermissionByRoleId(Long roleId, SysPermissionService permissionService)
|
||||||
|
{
|
||||||
|
// 扫描所有在线 token
|
||||||
|
String pattern = CacheConstants.LOGIN_TOKEN_KEY + "*";
|
||||||
|
Collection<String> keys = redisCache.keys(pattern);
|
||||||
|
if (keys == null || keys.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (String key : keys)
|
||||||
|
{
|
||||||
|
LoginUser loginUser = redisCache.getCacheObject(key);
|
||||||
|
if (loginUser == null || loginUser.getUser() == null || loginUser.getUser().isAdmin())
|
||||||
|
{
|
||||||
|
// 管理员拥有所有权限,跳过
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断该用户是否拥有此角色
|
||||||
|
boolean hasRole = loginUser.getUser().getRoles() != null
|
||||||
|
&& loginUser.getUser().getRoles().stream().anyMatch(r -> roleId.equals(r.getRoleId()));
|
||||||
|
if (!hasRole)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 刷新权限缓存
|
||||||
|
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||||
|
refreshToken(loginUser);
|
||||||
|
log.info("角色[{}]权限变更,已刷新在线用户[{}]的权限缓存", roleId, loginUser.getUsername());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<set>
|
<set>
|
||||||
<if test="columnComment != null">column_comment = #{columnComment},</if>
|
<if test="columnComment != null">column_comment = #{columnComment},</if>
|
||||||
<if test="javaType != null">java_type = #{javaType},</if>
|
<if test="javaType != null">java_type = #{javaType},</if>
|
||||||
|
<if test="columnType != null">column_type = #{columnType},</if>
|
||||||
<if test="javaField != null">java_field = #{javaField},</if>
|
<if test="javaField != null">java_field = #{javaField},</if>
|
||||||
<if test="isInsert != null">is_insert = #{isInsert},</if>
|
<if test="isInsert != null">is_insert = #{isInsert},</if>
|
||||||
<if test="isEdit != null">is_edit = #{isEdit},</if>
|
<if test="isEdit != null">is_edit = #{isEdit},</if>
|
||||||
|
|||||||
@@ -315,7 +315,7 @@
|
|||||||
<script setup lang="ts" name="${BusinessName}">
|
<script setup lang="ts" name="${BusinessName}">
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
#if($genView)
|
#if($genView)
|
||||||
import ${BusinessName}ViewDrawer from "./view"
|
import ${BusinessName}ViewDrawer from "./view.vue"
|
||||||
#end
|
#end
|
||||||
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
||||||
import type { TreeSelect } from '@/types/api/common'
|
import type { TreeSelect } from '@/types/api/common'
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${mod
|
|||||||
#end
|
#end
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
#if($genView)
|
#if($genView)
|
||||||
import ${BusinessName}ViewDrawer from "./view"
|
import ${BusinessName}ViewDrawer from "./view.vue"
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export function markNoticeReadAll(ids) {
|
|||||||
export function listNoticeReadUsers(query) {
|
export function listNoticeReadUsers(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/notice/readUsers/list',
|
url: '/system/notice/readUsers/list',
|
||||||
method: 'post',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if(this.defaultTheme !== ORIGINAL_THEME) {
|
if (this.defaultTheme !== ORIGINAL_THEME) {
|
||||||
this.setTheme(this.defaultTheme)
|
this.setTheme(this.defaultTheme)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* v-hasPermi 操作权限处理
|
* v-hasPermi 操作权限处理
|
||||||
* Copyright (c) 2019 ruoyi
|
* Copyright (c) 2019 ruoyi
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* v-hasRole 角色权限处理
|
* v-hasRole 角色权限处理
|
||||||
* Copyright (c) 2019 ruoyi
|
* Copyright (c) 2019 ruoyi
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
'--chrome-tab-active-bg': this.mixHexWithWhite(primary, 0.15),
|
'--chrome-tab-active-bg': this.mixHexWithWhite(primary, 0.15),
|
||||||
'--chrome-tab-text-active': primary,
|
'--chrome-tab-text-active': primary,
|
||||||
'--chrome-wing-r': '14px'
|
'--chrome-wing-r': '10px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -610,16 +610,19 @@ $tags-bar-height: 34px;
|
|||||||
background: #f5f7fa !important;
|
background: #f5f7fa !important;
|
||||||
border-radius: 6px 6px 0 0;
|
border-radius: 6px 6px 0 0;
|
||||||
color: #303133 !important;
|
color: #303133 !important;
|
||||||
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
height: 31px;
|
height: 33px;
|
||||||
min-height: 31px;
|
min-height: 33px;
|
||||||
padding: 0 14px;
|
padding: 0 14px;
|
||||||
|
z-index: 3;
|
||||||
color: var(--chrome-tab-text-active) !important;
|
color: var(--chrome-tab-text-active) !important;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
background: var(--chrome-tab-active-bg) !important;
|
background: var(--chrome-tab-active-bg) !important;
|
||||||
border: none !important;
|
border: none !important;
|
||||||
|
border-bottom: 2px solid var(--chrome-tab-active-bg) !important;
|
||||||
border-radius: var(--chrome-wing-r) var(--chrome-wing-r) 0 0;
|
border-radius: var(--chrome-wing-r) var(--chrome-wing-r) 0 0;
|
||||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
||||||
|
|
||||||
@@ -690,12 +693,33 @@ $tags-bar-height: 34px;
|
|||||||
.el-scrollbar__bar {
|
.el-scrollbar__bar {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.3s;
|
transition: opacity 0.3s;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
.tags-view-container:hover & {
|
.tags-view-container:hover & {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tags-view-container--chrome & {
|
||||||
|
.el-scrollbar {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-scrollbar__wrap {
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 0 !important;
|
||||||
|
height: 0 !important;
|
||||||
|
}
|
||||||
|
scrollbar-width: none;
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-scrollbar__bar.is-horizontal {
|
||||||
|
z-index: 20;
|
||||||
|
height: 6px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tags-view-item {
|
.tags-view-item {
|
||||||
.el-icon-close {
|
.el-icon-close {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
|||||||
@@ -76,10 +76,10 @@ export default {
|
|||||||
this.routers.map((router) => {
|
this.routers.map((router) => {
|
||||||
for (var item in router.children) {
|
for (var item in router.children) {
|
||||||
if (router.children[item].parentPath === undefined) {
|
if (router.children[item].parentPath === undefined) {
|
||||||
if(router.path === "/") {
|
if (router.path === "/") {
|
||||||
router.children[item].path = "/" + router.children[item].path
|
router.children[item].path = "/" + router.children[item].path
|
||||||
} else {
|
} else {
|
||||||
if(!isHttp(router.children[item].path)) {
|
if (!isHttp(router.children[item].path)) {
|
||||||
router.children[item].path = router.path + "/" + router.children[item].path
|
router.children[item].path = router.path + "/" + router.children[item].path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ export default {
|
|||||||
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"))
|
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"))
|
||||||
this.$store.dispatch('app/toggleSideBarHide', false)
|
this.$store.dispatch('app/toggleSideBarHide', false)
|
||||||
}
|
}
|
||||||
} else if(!this.$route.children) {
|
} else if (!this.$route.children) {
|
||||||
activePath = path
|
activePath = path
|
||||||
this.$store.dispatch('app/toggleSideBarHide', true)
|
this.$store.dispatch('app/toggleSideBarHide', true)
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(routes.length > 0) {
|
if (routes.length > 0) {
|
||||||
this.$store.commit("SET_SIDEBAR_ROUTERS", routes)
|
this.$store.commit("SET_SIDEBAR_ROUTERS", routes)
|
||||||
} else {
|
} else {
|
||||||
this.$store.dispatch('app/toggleSideBarHide', true)
|
this.$store.dispatch('app/toggleSideBarHide', true)
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ router.beforeEach((to, from, next) => {
|
|||||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||||
})
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
Message.error(err)
|
Message.error(err)
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ const mutations = {
|
|||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
state.cachedViews.splice(i, 1)
|
state.cachedViews.splice(i, 1)
|
||||||
}
|
}
|
||||||
if(item.meta.link) {
|
if (item.meta.link) {
|
||||||
const fi = state.iframeViews.findIndex(v => v.path === item.path)
|
const fi = state.iframeViews.findIndex(v => v.path === item.path)
|
||||||
state.iframeViews.splice(fi, 1)
|
state.iframeViews.splice(fi, 1)
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ const mutations = {
|
|||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
state.cachedViews.splice(i, 1)
|
state.cachedViews.splice(i, 1)
|
||||||
}
|
}
|
||||||
if(item.meta.link) {
|
if (item.meta.link) {
|
||||||
const fi = state.iframeViews.findIndex(v => v.path === item.path)
|
const fi = state.iframeViews.findIndex(v => v.path === item.path)
|
||||||
state.iframeViews.splice(fi, 1)
|
state.iframeViews.splice(fi, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
import { MessageBox, } from 'element-ui'
|
import cache from '@/plugins/cache'
|
||||||
|
import { MessageBox } from 'element-ui'
|
||||||
import { login, logout, getInfo } from '@/api/login'
|
import { login, logout, getInfo } from '@/api/login'
|
||||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||||
import { isHttp, isEmpty } from "@/utils/validate"
|
import { isHttp, isEmpty } from "@/utils/validate"
|
||||||
@@ -79,6 +80,7 @@ const user = {
|
|||||||
commit('SET_NAME', user.userName)
|
commit('SET_NAME', user.userName)
|
||||||
commit('SET_NICK_NAME', user.nickName)
|
commit('SET_NICK_NAME', user.nickName)
|
||||||
commit('SET_AVATAR', avatar)
|
commit('SET_AVATAR', avatar)
|
||||||
|
cache.session.set('pwrChrtype', res.pwdChrtype)
|
||||||
/* 初始密码提示 */
|
/* 初始密码提示 */
|
||||||
if(res.isDefaultModifyPwd) {
|
if(res.isDefaultModifyPwd) {
|
||||||
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||||
|
|||||||
71
ruoyi-ui/src/utils/passwordRule.js
Normal file
71
ruoyi-ui/src/utils/passwordRule.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* 密码强度规则
|
||||||
|
* 根据参数 chrtype 动态生成校验规则
|
||||||
|
*
|
||||||
|
* chrtype 说明:
|
||||||
|
* 0 - 任意字符(默认)
|
||||||
|
* 1 - 纯数字(0-9)
|
||||||
|
* 2 - 纯字母(a-z / A-Z)
|
||||||
|
* 3 - 字母 + 数字(必须同时包含)
|
||||||
|
* 4 - 字母 + 数字 + 特殊字符(必须同时包含,特殊字符:~!@#$%^&*()-=_+)
|
||||||
|
*/
|
||||||
|
import cache from '@/plugins/cache'
|
||||||
|
|
||||||
|
// 各类型对应的正则、错误提示
|
||||||
|
const PWD_RULES = {
|
||||||
|
'0': { pattern: /^[^<>"'|\\]+$/, message: '密码不能包含非法字符:< > " \' \\ |' },
|
||||||
|
'1': { pattern: /^[0-9]+$/, message: '密码只能为数字(0-9)' },
|
||||||
|
'2': { pattern: /^[a-zA-Z]+$/, message: '密码只能为英文字母(a-z、A-Z)' },
|
||||||
|
'3': { pattern: /^(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]+$/, message: '密码必须同时包含字母和数字' },
|
||||||
|
'4': { pattern: /^(?=.*[A-Za-z])(?=.*\d)(?=.*[~!@#$%^&*()\-=_+])[A-Za-z\d~!@#$%^&*()\-=_+]+$/, message: '密码必须同时包含字母、数字和特殊字符(~!@#$%^&*()-=_+)' }
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 密码限制类型
|
||||||
|
pwdChrType: cache.session.get('pwrChrtype') || '0'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 默认密码校验
|
||||||
|
pwdValidator() {
|
||||||
|
const rule = PWD_RULES[this.pwdChrType] || PWD_RULES['0']
|
||||||
|
return [
|
||||||
|
{ required: true, message: '密码不能为空', trigger: 'blur' },
|
||||||
|
{ min: 6, max: 20, message: '密码长度必须介于 6 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: rule.pattern, message: rule.message, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 校验prompt的inputValidator函数
|
||||||
|
pwdPromptValidator() {
|
||||||
|
const rule = PWD_RULES['0']
|
||||||
|
return (value) => {
|
||||||
|
if (!value || value.length < 6 || value.length > 20) {
|
||||||
|
return '密码长度必须介于 6 和 20 之间'
|
||||||
|
}
|
||||||
|
if (!rule.pattern.test(value)) {
|
||||||
|
return rule.message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 个人中心密码校验
|
||||||
|
infoPwdValidator() {
|
||||||
|
const rule = PWD_RULES[this.pwdChrType] || PWD_RULES['0']
|
||||||
|
return [
|
||||||
|
{ required: true, message: '新密码不能为空', trigger: 'blur' },
|
||||||
|
{ min: 6, max: 20, message: '新密码长度必须介于 6 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: rule.pattern, message: rule.message, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 注册页面密码校验
|
||||||
|
registerPwdValidator() {
|
||||||
|
const rule = PWD_RULES['0']
|
||||||
|
return [
|
||||||
|
{ required: true, message: '请输入您的密码', trigger: 'blur' },
|
||||||
|
{ min: 6, max: 20, message: '用户密码长度必须介于 6 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: rule.pattern, message: rule.message, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -68,59 +68,59 @@ service.interceptors.request.use(config => {
|
|||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(res => {
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = res.data.code || 200
|
const code = res.data.code || 200
|
||||||
// 获取错误信息
|
// 获取错误信息
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
// 二进制数据则直接返回
|
// 二进制数据则直接返回
|
||||||
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
if (!isRelogin.show) {
|
if (!isRelogin.show) {
|
||||||
isRelogin.show = true
|
isRelogin.show = true
|
||||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||||
isRelogin.show = false
|
isRelogin.show = false
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = '/index'
|
location.href = '/index'
|
||||||
})
|
})
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
isRelogin.show = false
|
isRelogin.show = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
Message({ message: msg, type: 'error' })
|
Message({ message: msg, type: 'error' })
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
} else if (code === 601) {
|
} else if (code === 601) {
|
||||||
Message({ message: msg, type: 'warning' })
|
Message({ message: msg, type: 'warning' })
|
||||||
return Promise.reject('error')
|
return Promise.reject('error')
|
||||||
} else if (code !== 200) {
|
} else if (code !== 200) {
|
||||||
Notification.error({ title: msg })
|
Notification.error({ title: msg })
|
||||||
return Promise.reject('error')
|
return Promise.reject('error')
|
||||||
} else {
|
} else {
|
||||||
return res.data
|
return res.data
|
||||||
}
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
console.log('err' + error)
|
|
||||||
let { message } = error
|
|
||||||
if (message == "Network Error") {
|
|
||||||
message = "后端接口连接异常"
|
|
||||||
} else if (message.includes("timeout")) {
|
|
||||||
message = "系统接口请求超时"
|
|
||||||
} else if (message.includes("Request failed with status code")) {
|
|
||||||
message = "系统接口" + message.slice(-3) + "异常"
|
|
||||||
}
|
|
||||||
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
|
||||||
return Promise.reject(error)
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
console.log('err' + error)
|
||||||
|
let { message } = error
|
||||||
|
if (message == "Network Error") {
|
||||||
|
message = "后端接口连接异常"
|
||||||
|
} else if (message.includes("timeout")) {
|
||||||
|
message = "系统接口请求超时"
|
||||||
|
} else if (message.includes("Request failed with status code")) {
|
||||||
|
message = "系统接口" + message.slice(-3) + "异常"
|
||||||
|
}
|
||||||
|
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export function selectDictLabel(datas, value) {
|
|||||||
|
|
||||||
// 回显数据字典(字符串、数组)
|
// 回显数据字典(字符串、数组)
|
||||||
export function selectDictLabels(datas, value, separator) {
|
export function selectDictLabels(datas, value, separator) {
|
||||||
if (value === undefined || value.length ===0) {
|
if (value === undefined || value.length === 0) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
|
|||||||
@@ -5,7 +5,12 @@
|
|||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
export function isPathMatch(pattern, path) {
|
export function isPathMatch(pattern, path) {
|
||||||
const regexPattern = pattern.replace(/\//g, '\\/').replace(/\*\*/g, '.*').replace(/\*/g, '[^\\/]*')
|
const regexPattern = pattern
|
||||||
|
.replace(/([.+^${}()|\[\]\\])/g, '\\$1')
|
||||||
|
.replace(/\*\*/g, '__DOUBLE_STAR__')
|
||||||
|
.replace(/\*/g, '[^/]*')
|
||||||
|
.replace(/__DOUBLE_STAR__/g, '.*')
|
||||||
|
.replace(/\?/g, '[^/]')
|
||||||
const regex = new RegExp(`^${regexPattern}$`)
|
const regex = new RegExp(`^${regexPattern}$`)
|
||||||
return regex.test(path)
|
return regex.test(path)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password" :rules="registerPwdValidator">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="registerForm.password"
|
v-model="registerForm.password"
|
||||||
type="password"
|
type="password"
|
||||||
@@ -68,18 +68,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg, register } from "@/api/login"
|
import { getCodeImg, register } from "@/api/login"
|
||||||
|
import passwordRule from "@/utils/passwordRule"
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Register",
|
mixins: [passwordRule],
|
||||||
data() {
|
data() {
|
||||||
const equalToPassword = (rule, value, callback) => {
|
|
||||||
if (this.registerForm.password !== value) {
|
|
||||||
callback(new Error("两次输入的密码不一致"))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
title: process.env.VUE_APP_TITLE,
|
title: process.env.VUE_APP_TITLE,
|
||||||
footerContent: defaultSettings.footerContent,
|
footerContent: defaultSettings.footerContent,
|
||||||
@@ -91,24 +85,31 @@ export default {
|
|||||||
code: "",
|
code: "",
|
||||||
uuid: ""
|
uuid: ""
|
||||||
},
|
},
|
||||||
registerRules: {
|
loading: false,
|
||||||
|
captchaEnabled: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
registerRules() {
|
||||||
|
return {
|
||||||
username: [
|
username: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
||||||
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
password: [
|
|
||||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
|
||||||
{ min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" },
|
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
||||||
],
|
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
{ required: true, message: "请再次输入您的密码", trigger: "blur" },
|
||||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (this.registerForm.password !== value) {
|
||||||
|
callback(new Error("两次输入的密码不一致"))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}, trigger: "blur"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||||
},
|
}
|
||||||
loading: false,
|
|
||||||
captchaEnabled: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 选择角色权限范围触发 */
|
/** 选择角色权限范围触发 */
|
||||||
dataScopeSelectChange(value) {
|
dataScopeSelectChange(value) {
|
||||||
if(value !== '2') {
|
if (value !== '2') {
|
||||||
this.$refs.dept.setCheckedKeys([])
|
this.$refs.dept.setCheckedKeys([])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -116,7 +116,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password" :rules="pwdValidator">
|
||||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -181,9 +181,11 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css"
|
|||||||
import TreePanel from "@/components/TreePanel"
|
import TreePanel from "@/components/TreePanel"
|
||||||
import ExcelImportDialog from "@/components/ExcelImportDialog"
|
import ExcelImportDialog from "@/components/ExcelImportDialog"
|
||||||
import UserViewDrawer from "./view"
|
import UserViewDrawer from "./view"
|
||||||
|
import passwordRule from "@/utils/passwordRule"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "User",
|
name: "User",
|
||||||
|
mixins: [passwordRule],
|
||||||
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
||||||
components: { Treeselect, TreePanel, ExcelImportDialog, UserViewDrawer },
|
components: { Treeselect, TreePanel, ExcelImportDialog, UserViewDrawer },
|
||||||
data() {
|
data() {
|
||||||
@@ -248,11 +250,6 @@ export default {
|
|||||||
nickName: [
|
nickName: [
|
||||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
password: [
|
|
||||||
{ required: true, message: "用户密码不能为空", trigger: "blur" },
|
|
||||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
|
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
||||||
],
|
|
||||||
email: [
|
email: [
|
||||||
{
|
{
|
||||||
type: "email",
|
type: "email",
|
||||||
@@ -405,17 +402,11 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
handleResetPwd(row) {
|
handleResetPwd(row) {
|
||||||
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
this.$prompt(`请输入「${row.userName}」的新密码`, "重置密码", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
inputPattern: /^.{5,20}$/,
|
inputValidator: this.pwdPromptValidator
|
||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
|
||||||
inputValidator: (value) => {
|
|
||||||
if (/<|>|"|'|\||\\/.test(value)) {
|
|
||||||
return "不能包含非法字符:< > \" ' \\\ |"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.userId, value).then(() => {
|
resetUserPwd(row.userId, value).then(() => {
|
||||||
this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="user" :rules="formRules" label-width="80px">
|
||||||
<el-form-item label="旧密码" prop="oldPassword">
|
<el-form-item label="旧密码" prop="oldPassword">
|
||||||
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="新密码" prop="newPassword">
|
<el-form-item label="新密码" prop="newPassword" :rules="infoPwdValidator">
|
||||||
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password/>
|
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="确认密码" prop="confirmPassword">
|
<el-form-item label="确认密码" prop="confirmPassword">
|
||||||
@@ -18,35 +18,36 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { updateUserPwd } from "@/api/system/user"
|
import { updateUserPwd } from "@/api/system/user"
|
||||||
|
import passwordRule from "@/utils/passwordRule"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [passwordRule],
|
||||||
data() {
|
data() {
|
||||||
const equalToPassword = (rule, value, callback) => {
|
|
||||||
if (this.user.newPassword !== value) {
|
|
||||||
callback(new Error("两次输入的密码不一致"))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
user: {
|
user: {
|
||||||
oldPassword: undefined,
|
oldPassword: undefined,
|
||||||
newPassword: undefined,
|
newPassword: undefined,
|
||||||
confirmPassword: undefined
|
confirmPassword: undefined
|
||||||
},
|
}
|
||||||
// 表单校验
|
}
|
||||||
rules: {
|
},
|
||||||
|
computed: {
|
||||||
|
formRules() {
|
||||||
|
return {
|
||||||
oldPassword: [
|
oldPassword: [
|
||||||
{ required: true, message: "旧密码不能为空", trigger: "blur" }
|
{ required: true, message: "旧密码不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
newPassword: [
|
|
||||||
{ required: true, message: "新密码不能为空", trigger: "blur" },
|
|
||||||
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" },
|
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
||||||
],
|
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
||||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (this.user.newPassword !== value) {
|
||||||
|
callback(new Error("两次输入的密码不一致"))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}, trigger: "blur"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 选择生成模板触发 */
|
/** 选择生成模板触发 */
|
||||||
tplSelectChange(value) {
|
tplSelectChange(value) {
|
||||||
if(value !== 'sub') {
|
if (value !== 'sub') {
|
||||||
this.info.subTableName = ''
|
this.info.subTableName = ''
|
||||||
this.info.subTableFkName = ''
|
this.info.subTableFkName = ''
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ export default {
|
|||||||
this.$modal.msgError("请选择要生成的数据")
|
this.$modal.msgError("请选择要生成的数据")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(row.genType === "1") {
|
if (row.genType === "1") {
|
||||||
genCode(row.tableName).then(() => {
|
genCode(row.tableName).then(() => {
|
||||||
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath)
|
this.$modal.msgSuccess("成功生成到自定义路径:" + row.genPath)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -553,6 +553,7 @@ insert into sys_config values(5, '账号自助-是否开启用户注册功能',
|
|||||||
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的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框');
|
insert into sys_config values(8, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', sysdate(), '', null, '密码更新周期(填写数字,数据初始化值为0不限制,若修改必须为大于0小于365的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框');
|
||||||
|
insert into sys_config values(9, '用户管理-密码字符范围', 'sys.account.chrtype', '0', 'Y', 'admin', sysdate(), '', null, '默认任意字符范围,0任意(密码可以输入任意字符),1数字(密码只能为0-9数字),2英文字母(密码只能为a-z和A-Z字母),3字母和数字(密码必须包含字母,数字),4字母数字和特殊字符(目前支持的特殊字符包括:~!@#$%^&*()-=_+)');
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
Reference in New Issue
Block a user