Announcement Announcement Module
Collapse
No announcement yet.
Toggle Login/Logout with User Details Displayed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Toggle Login/Logout with User Details Displayed

    Here is a change that I would recommend to the \src\main\webapp\WEB-INF\layouts\default.jspx:

    Change this:

    Code:
    <c:if test="${pageContext.request.userPrincipal != null}">	
    	<c:out value="*|*"/>
    	<span>			    
    		<spring:url var="logout" value="/static/j_spring_security_logout" />
    		<a href="${logout}"><spring:message code="security.logout" /></a>
    	</span>					    
    </c:if>
    To this:

    Code:
    <c:choose>
    	<c:when test="${pageContext.request.userPrincipal != null}">
    		<c:out value="*|*"/>
    		<span>
    		<spring:url var="logout" value="/static/j_spring_security_logout" />
    		<a href="${logout}"><spring:message code="security.logout" /></a>
    		</span>
    		<c:out value="*|*"/>
    		User Logged In: <b>${pageContext.request.userPrincipal.name}</b>
    		</c:when>
    	<c:otherwise>
    		<c:out value="*|*"/>
    		<span>
    		<spring:url var="login" value="/login" />
    		<a href="${login}"><spring:message code="security.login" /></a>
    		</span> 
    	</c:otherwise>
    </c:choose>
    This will toggle the logout/login link and show the user logged in next to the logout link.

    As always, suggestions for improvement are always welcome.

  • #2
    FYI... for some reason the forum isn't allowing for the correct c:out
    &#160;
    value, but the info above should be clear enough to interpret. Sorry about that.

    Comment


    • #3
      Thanks for the suggestion.

      Would you mind logging this as a Jira enhancement request at https://jira.springsource.org/browse/ROO? Thanks!

      Cheers
      Ben

      Comment


      • #4
        Added: https://jira.springsource.org/browse/ROO-468

        :-)

        Comment

        Working...
        X