fix login / logout

This commit is contained in:
Anton Romanov 2019-11-27 13:31:08 +04:00
parent c57914db7c
commit 71448364d7
4 changed files with 62 additions and 3 deletions

View File

@ -14,7 +14,7 @@ public class Constants {
public static final String LOGIN_REGEX = "^[_'.@A-Za-z0-9-]*$";
public static final String COOKIES_NAME = "JSESSIONID";
public static final String LOGOUT_URL = "/login?logout";
public static final String LOGOUT_URL = "/login.xhtml";
public static final String SESSION_ID_ATTR = "sessionId";
public static final int SESSION_TIMEOUT_SECONDS = 30 * 60;

View File

@ -109,6 +109,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
public void configure(WebSecurity web) {
web.ignoring()
.antMatchers("/css/**")
.antMatchers("/javax.faces.resource/**")
.antMatchers("/js/**")
.antMatchers("/templates/**")
.antMatchers("/webjars/**")

View File

@ -38,7 +38,7 @@
<p:menuitem value="Quit" url="http://www.primefaces.org" icon="pi pi-times"/>
<f:facet name="options">
<p:commandButton type="button" value="Logout" icon="pi pi-home"/>
<p:link href="/logout" value="Logout"/>
</f:facet>
</p:menubar>
<div class="ui-fluid">

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Вход в систему</title>
</h:head>
<h:body>
<div class="ui-g">
<div class="ui-g-5"></div>
<div class="ui-g-2">
<form method="post" action="/login.xhtml">
<p:panel header="Вход в систему" style="margin-bottom:20px">
<table cellpadding="10" style="width: 100%">
<tbody>
<tr>
<td>
<div></div>
</td>
</tr>
<tr>
<td><input id="username" name="username" type="text" placeholder="email"
class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all form-control"
style="width: 100%"/>
</td>
</tr>
<tr>
<td>
<input id="password" name="password" type="password" placeholder="Пароль"
class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all form-control"
style="width: 100%"/>
</td>
</tr>
<tr>
<td>
<button id="j_idt15" name="j_idt15"
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only btn btn-default"
type="submit">
<span class="ui-button-text ui-c">Войти</span>
</button>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
</p:panel>
</form>
</div>
<div class="ui-g-5"></div>
</div>
</h:body>
</html>