}
try
{
// Authenticate the user and get the object.
User user = TurbineSecurity.getAuthenticatedUser(
username, password);
// Store the user object.
data.setUser(user);
// Mark the user as being logged in.
user.setHasLoggedIn(Boolean.TRUE);
// Set the last_login date in the database.
user.updateLastLogin();
// This only happens if the user is valid; otherwise, we
// will get a valueBound in the User object when we don't
// want to because the username is not set yet. Save the
// User object into the session.