|
|
|
@ -2,7 +2,6 @@ package com.xxl.job.admin.controller;
|
|
|
|
|
|
|
|
|
|
import com.xxl.job.admin.controller.annotation.PermessionLimit;
|
|
|
|
|
import com.xxl.job.admin.controller.interceptor.PermissionInterceptor;
|
|
|
|
|
import com.xxl.job.admin.core.util.PropertiesUtil;
|
|
|
|
|
import com.xxl.job.admin.service.XxlJobService;
|
|
|
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -61,18 +60,21 @@ public class IndexController {
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@PermessionLimit(limit=false)
|
|
|
|
|
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
|
|
|
|
|
if (!PermissionInterceptor.ifLogin(request)) {
|
|
|
|
|
if (StringUtils.isNotBlank(userName) && StringUtils.isNotBlank(password)
|
|
|
|
|
&& PropertiesUtil.getString("xxl.job.login.username").equals(userName)
|
|
|
|
|
&& PropertiesUtil.getString("xxl.job.login.password").equals(password)) {
|
|
|
|
|
boolean ifRem = false;
|
|
|
|
|
if (StringUtils.isNotBlank(ifRemember) && "on".equals(ifRemember)) {
|
|
|
|
|
ifRem = true;
|
|
|
|
|
}
|
|
|
|
|
PermissionInterceptor.login(response, ifRem);
|
|
|
|
|
} else {
|
|
|
|
|
return new ReturnT<String>(500, "账号或密码错误");
|
|
|
|
|
}
|
|
|
|
|
// valid
|
|
|
|
|
if (PermissionInterceptor.ifLogin(request)) {
|
|
|
|
|
return ReturnT.SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// param
|
|
|
|
|
if (StringUtils.isBlank(userName) || StringUtils.isBlank(password)){
|
|
|
|
|
return new ReturnT<String>(500, "账号或密码为空");
|
|
|
|
|
}
|
|
|
|
|
boolean ifRem = (StringUtils.isNotBlank(ifRemember) && "on".equals(ifRemember))?true:false;
|
|
|
|
|
|
|
|
|
|
// do login
|
|
|
|
|
boolean loginRet = PermissionInterceptor.login(response, userName, password, ifRem);
|
|
|
|
|
if (!loginRet) {
|
|
|
|
|
return new ReturnT<String>(500, "账号或密码错误");
|
|
|
|
|
}
|
|
|
|
|
return ReturnT.SUCCESS;
|
|
|
|
|
}
|
|
|
|
|