【修改】登录市场和方法统一修改
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.jero.common.exception;
|
||||
|
||||
import io.lettuce.core.RedisConnectionException;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.apache.shiro.authz.UnauthorizedException;
|
||||
import com.jero.common.api.vo.Result;
|
||||
@@ -29,7 +29,7 @@ public class JeroBootExceptionHandler {
|
||||
* 处理自定义异常
|
||||
*/
|
||||
@ExceptionHandler(JeroBootException.class)
|
||||
public Result<?> handleRRException(JeroBootException e){
|
||||
public Result<?> handleJeroBootException(JeroBootException e){
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
+3
-2
@@ -28,8 +28,9 @@ import com.jero.common.util.oConvertUtils;
|
||||
**/
|
||||
public class JwtUtil {
|
||||
|
||||
// Token过期时间30分钟(用户登录过期时间是此时间的两倍,以token在reids缓存时间为准)
|
||||
public static final long EXPIRE_TIME = 60 * 60 * 1000;
|
||||
// Token过期时间180分钟(用户登录过期时间是此时间的两倍,以token在reids缓存时间为准)
|
||||
public static final long EXPIRE_TIME = 180 * 60 * 1000;
|
||||
// public static final long EXPIRE_TIME = 2000;
|
||||
|
||||
/**
|
||||
* 校验token是否正确
|
||||
|
||||
+6
-8
@@ -143,8 +143,7 @@ public class OnlCgformApiController {
|
||||
Result var2 = new Result();
|
||||
OnlCgformHead var3 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
var2.error500("实体不存在");
|
||||
return var2;
|
||||
return Result.error("实体不存在");
|
||||
} else {
|
||||
OnlComplexModel var4 = this.onlineService.queryOnlineConfig(var3);
|
||||
var4.setIsDesForm(var3.getIsDesForm());
|
||||
@@ -167,8 +166,7 @@ public class OnlCgformApiController {
|
||||
Result var3 = new Result();
|
||||
OnlCgformHead var4 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var4 == null) {
|
||||
var3.error500("实体不存在");
|
||||
return var3;
|
||||
return Result.error("实体不存在");
|
||||
} else {
|
||||
try {
|
||||
String var5 = var4.getTableName();
|
||||
@@ -178,7 +176,7 @@ public class OnlCgformApiController {
|
||||
var3.setResult(var7);
|
||||
} catch (Exception var8) {
|
||||
log.error(var8.getMessage(), var8);
|
||||
var3.error500("数据库查询失败," + var8.getMessage());
|
||||
return Result.error("数据库查询失败," + var8.getMessage());
|
||||
}
|
||||
|
||||
var3.setOnlTable(var4.getTableName());
|
||||
@@ -1100,7 +1098,7 @@ public class OnlCgformApiController {
|
||||
Result var3 = new Result();
|
||||
OnlCgformHead var4 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var4 == null) {
|
||||
var3.error500("实体不存在");
|
||||
var3.error("实体不存在");
|
||||
return var3;
|
||||
} else {
|
||||
try {
|
||||
@@ -1127,7 +1125,7 @@ public class OnlCgformApiController {
|
||||
var3.setResult(var11);
|
||||
} catch (Exception var12) {
|
||||
log.error(var12.getMessage(), var12);
|
||||
var3.error500("数据库查询失败" + var12.getMessage());
|
||||
var3.error("数据库查询失败" + var12.getMessage());
|
||||
}
|
||||
|
||||
var3.setOnlTable(var4.getTableName());
|
||||
@@ -1183,7 +1181,7 @@ public class OnlCgformApiController {
|
||||
Result var2 = new Result();
|
||||
OnlCgformHead var3 = (OnlCgformHead)this.onlCgformHeadService.getById(var1);
|
||||
if (var3 == null) {
|
||||
var2.error500("实体不存在");
|
||||
var2.error("实体不存在");
|
||||
return var2;
|
||||
} else {
|
||||
HashMap var4 = new HashMap();
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ public class CasClientController {
|
||||
String token = JwtUtil.sign(sysUser.getUsername(), sysUser.getPassword());
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
|
||||
//获取用户部门信息
|
||||
JSONObject obj = new JSONObject();
|
||||
|
||||
+1
-2
@@ -63,8 +63,7 @@ public class NgAlainController {
|
||||
result.setResult(ls);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
result.error500("操作失败");
|
||||
return result;
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
List<JSONObject> dictlist=new ArrayList<>();
|
||||
for (DictModel l : ls) {
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class SysDataLogController {
|
||||
queryWrapper.eq("data_id", dataId);
|
||||
List<SysDataLog> list = service.list(queryWrapper);
|
||||
if(list==null||list.size()<=0) {
|
||||
result.error500("未找到版本信息");
|
||||
return Result.error("未找到版本信息");
|
||||
}else {
|
||||
result.setResult(list);
|
||||
result.setSuccess(true);
|
||||
|
||||
+4
-4
@@ -118,7 +118,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
retryCount = (int) redisUtil.get(RETRY_LOGIN_PREFIX + username);
|
||||
}
|
||||
if (retryCount >= RETRY_LOGIN_MAX_COUNT){
|
||||
return Result.error("密码错误次数过多,请稍后重试");
|
||||
return Result.error("密码错误次数过多,请15分钟后重试");
|
||||
}
|
||||
//2. 校验用户名或密码是否正确
|
||||
String userpassword = PasswordUtil.encrypt(username, password, sysUser.getSalt());
|
||||
@@ -127,7 +127,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
// 重试登录次数加一
|
||||
retryCount++;
|
||||
if( retryCount == 1){
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,60 * 30);
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,60 * 15);
|
||||
}else {
|
||||
redisUtil.set(RETRY_LOGIN_PREFIX + username,retryCount,redisUtil.getExpire(RETRY_LOGIN_PREFIX + username));
|
||||
}
|
||||
@@ -409,7 +409,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
// 设置超时时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME*2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
|
||||
//token 信息
|
||||
obj.put("token", token);
|
||||
@@ -496,7 +496,7 @@ public class LoginServiceImpl implements ILoginService {
|
||||
String token = JwtUtil.sign(username, syspassword);
|
||||
// 设置token缓存有效时间
|
||||
redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000);
|
||||
redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME / 1000);
|
||||
|
||||
obj.put("token", token);
|
||||
obj.put("userInfo", sysUser);
|
||||
|
||||
@@ -14,7 +14,6 @@ whiteList.push(OAUTH2_LOGIN_PAGE_PATH)
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
NProgress.start() // start progress bar
|
||||
|
||||
if (Vue.ls.get(ACCESS_TOKEN)) {
|
||||
/* has token */
|
||||
if (to.path === '/user/login' || to.path === OAUTH2_LOGIN_PAGE_PATH) {
|
||||
@@ -66,13 +65,7 @@ router.beforeEach((to, from, next) => {
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
/* notification.error({
|
||||
message: '系统提示',
|
||||
description: '请求用户信息失败,请重试!'
|
||||
})*/
|
||||
store.dispatch('Logout').then(() => {
|
||||
next({ path: '/user/login', query: { redirect: to.fullPath } })
|
||||
})
|
||||
return Promise.reject()
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import { login, logout, phoneLogin, thirdLogin } from "@/api/login"
|
||||
import { ACCESS_TOKEN, USER_NAME,USER_INFO,USER_AUTH,SYS_BUTTON_AUTH,UI_CACHE_DB_DICT_DATA,TENANT_ID,CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
|
||||
import store from '@/store'
|
||||
import { welcome } from "@/utils/util"
|
||||
import { queryPermissionsByUser } from '@/api/api'
|
||||
import { getAction } from '@/api/manage'
|
||||
@@ -140,9 +141,14 @@ const user = {
|
||||
//update--end--autor:qinfeng-----date:20200109------for: 一级菜单的子菜单全部是隐藏路由,则一级菜单不显示------
|
||||
commit('SET_PERMISSIONLIST', menuData)
|
||||
} else {
|
||||
notification.error({
|
||||
message: '系统提示',
|
||||
description: '该用户无权限,请联系管理员!'
|
||||
Vue.prototype.$Jmodal.error({
|
||||
title: '无权限',
|
||||
content: '该用户无权限,请联系管理员!',
|
||||
okText: '确认',
|
||||
mask: false,
|
||||
onOk: () => {
|
||||
store.dispatch('Logout')
|
||||
}
|
||||
})
|
||||
reject('getPermissionList: permissions must be a non-null array !')
|
||||
}
|
||||
@@ -173,9 +179,7 @@ const user = {
|
||||
window.location.href = process.env.VUE_APP_CAS_BASE_URL + '/logout?service=' + serviceUrl
|
||||
}
|
||||
resolve()
|
||||
setTimeout (() => {
|
||||
location.reload();
|
||||
}, 1000)
|
||||
window.location.replace("/user/login")
|
||||
}).catch(() => {
|
||||
resolve()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user