Added thymeleaf versions of "login" and "logoutSuccess"

This commit is contained in:
Daniel Fernández
2012-09-14 00:15:43 +02:00
committed by Rossen Stoyanchev
parent 0e1a2453e0
commit 4545043fa5
3 changed files with 92 additions and 2 deletions

View File

@@ -0,0 +1,84 @@
<div class="span-5">
<p>Valid username/passwords are:</p>
<ul>
<li>keith/melbourne</li>
<li>erwin/leuven</li>
<li>jeremy/atlanta</li>
<li>scott/rochester</li>
</ul>
</div>
<div class="span-10 append-2 last"
xmlns:th="http://www.thymeleaf.org"
th:with="lastUsernameKey=${T(org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter).SPRING_SECURITY_LAST_USERNAME_KEY},
lastExceptionKey=${T(org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter).SPRING_SECURITY_LAST_EXCEPTION_KEY}">
<div class="error" th:if="${param.login_error}">
Your login attempt was not successful, try again.<br /><br />
Reason: <span th:text="${session[__${lastExceptionKey}__].message}">Invalid password</span>
</div>
<form name="f" action="#" th:action="@{/loginProcess}" method="post">
<fieldset>
<legend>Login Information</legend>
<p>
<label for="j_username">User:</label>
<br />
<input type="text" name="j_username" id="j_username"
th:value="${param.login_error} ? ${session[__${lastUsernameKey}__]} : ''" />
</p>
<script type="text/javascript">
// <![CDATA[
Spring.addDecoration(new Spring.ElementDecoration({
elementId : "j_username",
widgetType : "dijit.form.ValidationTextBox",
widgetAttrs : { required : true }}));
// ]]>
</script>
<p>
<label for="j_password">Password:</label>
<br />
<input type="password" name="j_password" id="j_password" />
</p>
<script type="text/javascript">
// <![CDATA[
Spring.addDecoration(new Spring.ElementDecoration({
elementId : "j_password",
widgetType : "dijit.form.ValidationTextBox",
widgetAttrs : { required : true}}));
// ]]>
</script>
<p>
<input type="checkbox" name="_spring_security_remember_me" id="remember_me" />
<label for="remember_me">Don't ask for my password for two weeks:</label>
</p>
<script type="text/javascript">
// <![CDATA[
Spring.addDecoration(new Spring.ElementDecoration({
elementId : "remember_me",
widgetType : "dijit.form.CheckBox"}));
// ]]>
</script>
<p>
<button id="submit" type="submit">Login</button>
<script type="text/javascript">
Spring.addDecoration(
new Spring.ValidateAllDecoration({event : 'onclick', elementId : 'submit'}));
</script>
</p>
</fieldset>
</form>
</div>

View File

@@ -0,0 +1,6 @@
<div xmlns:th="http://www.thymeleaf.org">
<h1>Logout</h1>
<p>You have successfully logged out.</p>
<hr />
<p><a href="hotels/searchForm.html" th:href="@{/hotels/search}">Continue</a></p>
</div>

View File

@@ -10,11 +10,11 @@
</definition>
<definition name="login" extends="standardLayout" templateType="jsp">
<put-attribute name="body" value="/WEB-INF/login.jsp" type="jsp"/>
<put-attribute name="body" value="login.html"/>
</definition>
<definition name="logoutSuccess" extends="standardLayout" templateType="jsp">
<put-attribute name="body" value="/WEB-INF/logoutSuccess.jsp" type="jsp"/>
<put-attribute name="body" value="logoutSuccess.html"/>
</definition>
</tiles-definitions>