Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
粉色的八爪鱼
xxl-job
提交
00465f53
X
xxl-job
项目概览
粉色的八爪鱼
/
xxl-job
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
xxl-job
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
00465f53
编写于
5月 14, 2016
作者:
X
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增记住密码功能
上级
baa61b01
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
20 addition
and
7 deletion
+20
-7
xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java
...src/main/java/com/xxl/job/controller/IndexController.java
+6
-2
xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/PermissionInterceptor.java
...xxl/job/controller/interceptor/PermissionInterceptor.java
+2
-2
xxl-job-admin/src/main/java/com/xxl/job/core/util/CookieUtil.java
...admin/src/main/java/com/xxl/job/core/util/CookieUtil.java
+11
-2
xxl-job-admin/src/main/webapp/WEB-INF/template/login.ftl
xxl-job-admin/src/main/webapp/WEB-INF/template/login.ftl
+1
-1
未找到文件。
xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java
浏览文件 @
00465f53
...
@@ -42,11 +42,15 @@ public class IndexController {
...
@@ -42,11 +42,15 @@ public class IndexController {
@RequestMapping
(
value
=
"login"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"login"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
@PermessionLimit
(
limit
=
false
)
@PermessionLimit
(
limit
=
false
)
public
ReturnT
<
String
>
loginDo
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
userName
,
String
password
){
public
ReturnT
<
String
>
loginDo
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
userName
,
String
password
,
String
ifRemember
){
if
(!
PermissionInterceptor
.
ifLogin
(
request
))
{
if
(!
PermissionInterceptor
.
ifLogin
(
request
))
{
if
(
StringUtils
.
isNotBlank
(
userName
)
&&
StringUtils
.
isNotBlank
(
password
)
if
(
StringUtils
.
isNotBlank
(
userName
)
&&
StringUtils
.
isNotBlank
(
password
)
&&
"admin"
.
equals
(
userName
)
&&
"123456"
.
equals
(
password
))
{
&&
"admin"
.
equals
(
userName
)
&&
"123456"
.
equals
(
password
))
{
PermissionInterceptor
.
login
(
response
);
boolean
ifRem
=
false
;
if
(
StringUtils
.
isNotBlank
(
ifRemember
)
&&
"on"
.
equals
(
ifRemember
))
{
ifRem
=
true
;
}
PermissionInterceptor
.
login
(
response
,
ifRem
);
}
else
{
}
else
{
return
new
ReturnT
<
String
>(
500
,
"账号或密码错误"
);
return
new
ReturnT
<
String
>(
500
,
"账号或密码错误"
);
}
}
...
...
xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/PermissionInterceptor.java
浏览文件 @
00465f53
...
@@ -18,8 +18,8 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
...
@@ -18,8 +18,8 @@ public class PermissionInterceptor extends HandlerInterceptorAdapter {
public
static
final
String
LOGIN_IDENTITY_KEY
=
"LOGIN_IDENTITY"
;
public
static
final
String
LOGIN_IDENTITY_KEY
=
"LOGIN_IDENTITY"
;
public
static
final
String
LOGIN_IDENTITY_VAL
=
"sdf!121sdf$78sd!8"
;
public
static
final
String
LOGIN_IDENTITY_VAL
=
"sdf!121sdf$78sd!8"
;
public
static
boolean
login
(
HttpServletResponse
response
){
public
static
boolean
login
(
HttpServletResponse
response
,
boolean
ifRemember
){
CookieUtil
.
set
(
response
,
LOGIN_IDENTITY_KEY
,
LOGIN_IDENTITY_VAL
);
CookieUtil
.
set
(
response
,
LOGIN_IDENTITY_KEY
,
LOGIN_IDENTITY_VAL
,
ifRemember
);
return
true
;
return
true
;
}
}
public
static
void
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
){
public
static
void
logout
(
HttpServletRequest
request
,
HttpServletResponse
response
){
...
...
xxl-job-admin/src/main/java/com/xxl/job/core/util/CookieUtil.java
浏览文件 @
00465f53
...
@@ -19,10 +19,19 @@ public class CookieUtil {
...
@@ -19,10 +19,19 @@ public class CookieUtil {
* @param response
* @param response
* @param key
* @param key
* @param value
* @param value
* @param ifRemember
*/
*/
public
static
void
set
(
HttpServletResponse
response
,
String
key
,
String
value
)
{
public
static
void
set
(
HttpServletResponse
response
,
String
key
,
String
value
,
boolean
ifRemember
)
{
int
age
=
COOKIE_MAX_AGE
;
if
(
ifRemember
)
{
age
=
COOKIE_MAX_AGE
;
}
else
{
age
=
-
1
;
}
Cookie
cookie
=
new
Cookie
(
key
,
value
);
Cookie
cookie
=
new
Cookie
(
key
,
value
);
cookie
.
setMaxAge
(
COOKIE_MAX_AGE
);
// Cookie过期时间,单位/秒
cookie
.
setMaxAge
(
age
);
// Cookie过期时间,单位/秒
cookie
.
setPath
(
COOKIE_PATH
);
// Cookie适用的路径
cookie
.
setPath
(
COOKIE_PATH
);
// Cookie适用的路径
response
.
addCookie
(
cookie
);
response
.
addCookie
(
cookie
);
}
}
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/login.ftl
浏览文件 @
00465f53
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
<div
class=
"col-xs-8"
>
<div
class=
"col-xs-8"
>
<div
class=
"checkbox icheck"
>
<div
class=
"checkbox icheck"
>
<label>
<label>
<input
type=
"checkbox"
>
Remember Me
<input
type=
"checkbox"
name=
"ifRemember"
>
Remember Me
</label>
</label>
</div>
</div>
</div>
<!-- /.col -->
</div>
<!-- /.col -->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录