PasswordPolicy fix

This commit is contained in:
Crystal.Sea
2020-09-01 21:08:37 +08:00
parent 5828d2fd1a
commit 1f0377e8ec
8 changed files with 71 additions and 19 deletions

View File

@@ -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");
}
}

View File

@@ -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>