Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
1f0377e8
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1f0377e8
编写于
9月 01, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PasswordPolicy fix
上级
5828d2fd
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
71 addition
and
19 deletion
+71
-19
maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java
...java/org/maxkey/authn/AbstractAuthenticationProvider.java
+2
-2
maxkey-core/src/main/java/org/maxkey/persistence/db/PasswordPolicyValidator.java
...va/org/maxkey/persistence/db/PasswordPolicyValidator.java
+4
-7
maxkey-core/src/main/java/org/maxkey/web/WebConstants.java
maxkey-core/src/main/java/org/maxkey/web/WebConstants.java
+2
-0
maxkey-core/src/main/resources/messages/passwordpolicy_message.properties
...main/resources/messages/passwordpolicy_message.properties
+14
-1
maxkey-core/src/main/resources/messages/passwordpolicy_message_en.properties
...n/resources/messages/passwordpolicy_message_en.properties
+13
-1
maxkey-core/src/main/resources/messages/passwordpolicy_message_zh_CN.properties
...esources/messages/passwordpolicy_message_zh_CN.properties
+13
-1
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LoginEndpoint.java
.../src/main/java/org/maxkey/web/endpoint/LoginEndpoint.java
+13
-7
maxkey-web-maxkey/src/main/resources/templates/views/login.ftl
...y-web-maxkey/src/main/resources/templates/views/login.ftl
+10
-0
未找到文件。
maxkey-core/src/main/java/org/maxkey/authn/AbstractAuthenticationProvider.java
浏览文件 @
1f0377e8
...
...
@@ -82,12 +82,12 @@ public abstract class AbstractAuthenticationProvider {
try
{
authentication
=
doInternalAuthenticate
(
authentication
);
}
catch
(
AuthenticationException
e
)
{
e
.
printStackTrace
();
_logger
.
error
(
"Failed to authenticate user {} via {}: {}"
,
new
Object
[]
{
authentication
.
getPrincipal
(),
getProviderName
(),
e
.
getMessage
()
});
WebContext
.
setAttribute
(
WebConstants
.
LOGIN_ERROR_SESSION_MESSAGE
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
String
message
=
"Unexpected exception in "
+
getProviderName
()
+
" authentication:"
;
_logger
.
error
(
"Login error "
+
message
,
e
);
}
...
...
maxkey-core/src/main/java/org/maxkey/persistence/db/PasswordPolicyValidator.java
浏览文件 @
1f0377e8
...
...
@@ -217,12 +217,10 @@ public class PasswordPolicyValidator {
_logger
.
debug
(
"PasswordPolicy : "
+
passwordPolicy
);
_logger
.
debug
(
"login Attempts is "
+
userInfo
.
getBadPasswordCount
());
lockUser
(
userInfo
);
throw
new
BadCredentialsException
(
userInfo
.
getUsername
()
+
" "
+
WebContext
.
getI18nValue
(
"login.error.attempts"
)
+
" "
+
userInfo
.
getBadPasswordCount
()
);
WebContext
.
getI18nValue
(
"login.error.attempts"
,
new
Object
[]{
userInfo
.
getUsername
(),
userInfo
.
getBadPasswordCount
()})
);
}
//locked
...
...
@@ -235,8 +233,7 @@ public class PasswordPolicyValidator {
// inactive
if
(
userInfo
.
getStatus
()!=
ConstantsStatus
.
ACTIVE
)
{
throw
new
BadCredentialsException
(
userInfo
.
getUsername
()+
" status "
+
userInfo
.
getStatus
()
+
userInfo
.
getUsername
()+
WebContext
.
getI18nValue
(
"login.error.inactive"
)
);
}
...
...
maxkey-core/src/main/java/org/maxkey/web/WebConstants.java
浏览文件 @
1f0377e8
...
...
@@ -72,5 +72,7 @@ public class WebConstants {
public
static
final
String
AUTHENTICATION
=
"current_authentication"
;
public
static
final
String
THEME_COOKIE_NAME
=
"maxkey_theme"
;
public
static
final
String
LOGIN_ERROR_SESSION_MESSAGE
=
"login_error_session_message_key"
;
}
maxkey-core/src/main/resources/messages/passwordpolicy_message.properties
浏览文件 @
1f0377e8
...
...
@@ -30,4 +30,17 @@ PasswordPolicy.TOO_SHORT=\u5bc6\u7801\u81f3\u5c11{0}\u4f4d\u5b57\u7b26.
PasswordPolicy.TOO_MANY_OCCURRENCES
=
\u
5bc6
\u7801\u5305\u
542b{0}
\u
51fa
\u
73b0{1},
\u6700\u
591a{2}
\u
6b21.
PasswordPolicy.OLD_PASSWORD_NOT_MATCH
=
\u
539f
\u
5bc6
\u7801\u
4e0d
\u5339\u
914d.
PasswordPolicy.CONFIRMPASSWORD_NOT_MATCH
=
\u
65b0
\u
5bc6
\u7801\u
4e0e
\u
786e
\u
8ba4
\u
5bc6
\u7801\u
4e0d
\u
4e00
\u
81f4.
PasswordPolicy.OLD_PASSWORD_MATCH
=
\u
65b0
\u
5bc6
\u7801\u
4e0d
\u
80fd
\u
4e0e
\u
65e7
\u
5bc6
\u7801\u
4e00
\u
81f4.
\ No newline at end of file
PasswordPolicy.OLD_PASSWORD_MATCH
=
\u
65b0
\u
5bc6
\u7801\u
4e0d
\u
80fd
\u
4e0e
\u
65e7
\u
5bc6
\u7801\u
4e00
\u
81f4.
login.error.attempts
=
{0}
\u
5c1d
\u
8bd5
\u
767b
\u9646
{1}
\u
6b21
\u6570\u
8fbe
\u5230\u6700\u5927\u9650\u5236\u
ff0c
\u
8bf7
\u
7a0d
\u
540e
\u
518d
\u
767b
\u9646
.
login.error.locked
=
\u7528\u6237\u
88ab
\u9501\u
5b9a.
login.error.inactive
=
\u7528\u6237\u
975e
\u
6d3b
\u
52a8
\u
72b6
\u6001
.
login.error.password
=
\u
767b
\u
5f55
\u
5bc6
\u7801\u
65e0
\u6548
.
login.error.username
=
\u7528\u6237\u
540d
\u
65e0
\u6548
.
login.error.username.null
=
\u7528\u6237\u
540d
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a.
login.error.email.null
=
\u
767b
\u
5f55
\u
90ae
\u
7bb1
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a.
login.error.password.null
=
\u
5bc6
\u7801\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a.
login.error.captcha
=
\u
9a8c
\u
8bc1
\u7801\u9519\u
8bef
\u
ff0c
\u
8bf7
\u
91cd
\u
65b0
\u
767b
\u9646
.
login.error.authtype
=
\u
767b
\u
5f55
\u
8ba4
\u
8bc1
\u
7c7b
\u
578b
\u9519\u
8bef.
login.error.session
=
\u
767b
\u
5f55
\u
4f1a
\u
8bdd
\u5931\u6548\u
ff0c
\u
8bf7
\u
91cd
\u
65b0
\u
767b
\u9646
.
maxkey-core/src/main/resources/messages/passwordpolicy_message_en.properties
浏览文件 @
1f0377e8
...
...
@@ -30,4 +30,16 @@ PasswordPolicy.TOO_SHORT=Password must be {0} or more characters in length .
PasswordPolicy.TOO_MANY_OCCURRENCES
=
Password contains {1} occurrences of the character '{0}', but at most {2} are allowed.
PasswordPolicy.OLD_PASSWORD_NOT_MATCH
=
old password not match.
PasswordPolicy.CONFIRMPASSWORD_NOT_MATCH
=
new password not match confirm password.
PasswordPolicy.OLD_PASSWORD_MATCH
=
new password match old password.
\ No newline at end of file
PasswordPolicy.OLD_PASSWORD_MATCH
=
new password match old password.
login.error.attempts
=
{0} login attempts the maximum number of {1} times, please login later.
login.error.locked
=
The user is locked.
login.error.inactive
=
User inactive state.
login.error.password
=
Invalid password.
login.error.username
=
Invalid username.
login.error.username.null
=
username cannot be empty.
login.error.email.null
=
email cannot be empty.
login.error.password.null
=
Password cannot be empty.
login.error.captcha
=
Verification code error, please login again.
login.error.authtype
=
Login authentication type error.
login.error.session
=
Login session failed. Please login again.
\ No newline at end of file
maxkey-core/src/main/resources/messages/passwordpolicy_message_zh_CN.properties
浏览文件 @
1f0377e8
...
...
@@ -30,4 +30,16 @@ PasswordPolicy.TOO_SHORT=\u5bc6\u7801\u81f3\u5c11{0}\u4f4d\u5b57\u7b26.
PasswordPolicy.TOO_MANY_OCCURRENCES
=
\u
5bc6
\u7801\u5305\u
542b{0}
\u
51fa
\u
73b0{1},
\u6700\u
591a{2}
\u
6b21.
PasswordPolicy.OLD_PASSWORD_NOT_MATCH
=
\u
539f
\u
5bc6
\u7801\u
4e0d
\u5339\u
914d.
PasswordPolicy.CONFIRMPASSWORD_NOT_MATCH
=
\u
65b0
\u
5bc6
\u7801\u
4e0e
\u
786e
\u
8ba4
\u
5bc6
\u7801\u
4e0d
\u
4e00
\u
81f4.
PasswordPolicy.OLD_PASSWORD_MATCH
=
\u
65b0
\u
5bc6
\u7801\u
4e0d
\u
80fd
\u
4e0e
\u
65e7
\u
5bc6
\u7801\u
4e00
\u
81f4.
\ No newline at end of file
PasswordPolicy.OLD_PASSWORD_MATCH
=
\u
65b0
\u
5bc6
\u7801\u
4e0d
\u
80fd
\u
4e0e
\u
65e7
\u
5bc6
\u7801\u
4e00
\u
81f4.
login.error.attempts
=
{0}
\u
5c1d
\u
8bd5
\u
767b
\u9646
{1}
\u
6b21
\u6570\u
8fbe
\u5230\u6700\u5927\u9650\u5236\u
ff0c
\u
8bf7
\u
7a0d
\u
540e
\u
518d
\u
767b
\u9646
.
login.error.locked
=
\u7528\u6237\u
88ab
\u9501\u
5b9a.
login.error.inactive
=
\u7528\u6237\u
975e
\u
6d3b
\u
52a8
\u
72b6
\u6001
.
login.error.password
=
\u
767b
\u
5f55
\u
5bc6
\u7801\u
65e0
\u6548
.
login.error.username
=
\u7528\u6237\u
540d
\u
65e0
\u6548
.
login.error.username.null
=
\u7528\u6237\u
540d
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a.
login.error.email.null
=
\u
767b
\u
5f55
\u
90ae
\u
7bb1
\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a.
login.error.password.null
=
\u
5bc6
\u7801\u
4e0d
\u
80fd
\u
4e3a
\u
7a7a.
login.error.captcha
=
\u
9a8c
\u
8bc1
\u7801\u9519\u
8bef
\u
ff0c
\u
8bf7
\u
91cd
\u
65b0
\u
767b
\u9646
.
login.error.authtype
=
\u
767b
\u
5f55
\u
8ba4
\u
8bc1
\u
7c7b
\u
578b
\u9519\u
8bef.
login.error.session
=
\u
767b
\u
5f55
\u
4f1a
\u
8bdd
\u5931\u6548\u
ff0c
\u
8bf7
\u
91cd
\u
65b0
\u
767b
\u9646
.
\ No newline at end of file
maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LoginEndpoint.java
浏览文件 @
1f0377e8
...
...
@@ -59,6 +59,8 @@ import org.springframework.web.servlet.ModelAndView;
public
class
LoginEndpoint
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
LoginEndpoint
.
class
);
@Autowired
@Qualifier
(
"applicationConfig"
)
ApplicationConfig
applicationConfig
;
...
...
@@ -170,6 +172,9 @@ public class LoginEndpoint {
return
WebContext
.
redirect
(
"/forwardindex"
);
}
Object
loginErrorMessage
=
WebContext
.
getAttribute
(
WebConstants
.
LOGIN_ERROR_SESSION_MESSAGE
);
modelAndView
.
addObject
(
"loginErrorMessage"
,
loginErrorMessage
==
null
?
""
:
loginErrorMessage
);
WebContext
.
removeAttribute
(
WebConstants
.
LOGIN_ERROR_SESSION_MESSAGE
);
return
modelAndView
;
}
...
...
@@ -178,14 +183,15 @@ public class LoginEndpoint {
HttpServletRequest
request
,
HttpServletResponse
response
,
@ModelAttribute
(
"authentication"
)
BasicAuthentication
authentication
)
throws
ServletException
,
IOException
{
authenticationProvider
.
authenticate
(
authentication
);
if
(
WebContext
.
isAuthenticated
())
{
return
WebContext
.
redirect
(
"/forwardindex"
);
}
else
{
return
WebContext
.
redirect
(
"/login"
);
}
authenticationProvider
.
authenticate
(
authentication
);
if
(
WebContext
.
isAuthenticated
()){
return
WebContext
.
redirect
(
"/forwardindex"
);
}
else
{
return
WebContext
.
redirect
(
"/login"
);
}
}
...
...
maxkey-web-maxkey/src/main/resources/templates/views/login.ftl
浏览文件 @
1f0377e8
...
...
@@ -204,6 +204,11 @@ $(function(){
<form
id=
"loginForm"
name=
"loginForm"
action=
"<@base />/logon.do"
method=
"post"
class=
"needs-validation"
novalidate
>
<input
type=
"hidden"
name=
"authType"
value=
"basic"
/>
<table
class=
"table login_form_table"
>
<tr
class=
"loginErrorMessage"
<
#if
''==
loginErrorMessage
>
style="display:none;"
</
#
if>
>
<td
colspan=
"2"
style=
"color:red;"
>
${loginErrorMessage!}
</td>
</tr>
<tr>
<td><
@
locale
code=
"login.text.username"
/>
:
</td>
<td><input
required=
""
class=
"form-control"
type=
'text'
id=
'j_username'
name=
'username'
value=
"admin"
tabindex=
"1"
/></td>
...
...
@@ -257,6 +262,11 @@ $(function(){
<form
id=
"tfaLoginForm"
name=
"tfaLoginForm"
action=
"<@base />/logon.do"
method=
"post"
class=
"needs-validation"
novalidate
>
<input
type=
"hidden"
name=
"authType"
value=
"tfa"
/>
<table
class=
"login_form_table"
>
<tr
class=
"loginErrorMessage"
<
#if
''==
loginErrorMessage
>
style="display:none;"
</
#
if>
>
<td
colspan=
"2"
style=
"color:red;"
>
${loginErrorMessage!}
</td>
</tr>
<tr>
<td><
@
locale
code=
"login.text.username"
/>
:
</td>
<td><input
required=
""
class=
"form-control"
type=
'text'
id=
'tfa_j_username'
name=
'username'
value=
""
tabindex=
"1"
/></td>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录