Announcement Announcement Module
Collapse
No announcement yet.
Logging of user login Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logging of user login

    Hey!

    I' ve a question: I would like to know when a user have log in for the last time. This is a simple function but i haven't a clue how to do this.
    i have a solution: after every login i can execute a sql-request: update table bla bla set last_login=timestamp bla bla..
    How can i do this?
    Or have anyone an other solution for my goal?

    danke.

  • #2
    Point the default target url to a custom controller, as indicated below in red. In the custom controller method, you can execute your update query and return ModelAndView with the next view.

    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">



    <http auto-config="false">
    <intercept-url pattern="principalBond.do"
    access="ROLE_PRINCIPAL_COMPLETED" />
    <form-login login-page="/index.jsp"
    login-processing-url="/j_spring_security_check"
    default-target-url="/loggedin.do" authentication-failure-url="/index.jsp?login_error=1" />
    <logout logout-success-url="/index.jsp?loggedout=true" />
    <remember-me key="xyz" services-ref="rememberMeServices" />
    </http>

    Comment


    • #3
      That is!
      Thanks.

      Comment


      • #4
        You might also want to investigate the AuthenticationSuccessEvent. You can listen for this event and then make a call to your dao to update the last_login with the timestamp from the event.

        http://static.springsource.org/sprin...cessEvent.html

        Dustin

        Comment

        Working...
        X