data.setMessage(message);
data.setStackTrace(org.apache.turbine.util.StringUtils.stackTrace(other), other);
return;
}
JetspeedUser user = (JetspeedUser)data.getUser();
//if the user is not logged in and auto-login is enable - try and do it.
if ( ( user==null || !user.hasLoggedIn() ) && JetspeedResources.getBoolean("automatic.logon.enable", false) ) {
// need to make sure there are cookies - turbine does not handle this currently
if ( data.getRequest().getCookies() != null )
{
//check for user in cookie
String userName = data.getCookies().getString("username","");
String loginCookieValue = data.getCookies().getString("logincookie","");
if ( userName.length() > 0 && loginCookieValue.length() >0 )
{
try {
user = JetspeedSecurity.getUser(userName);
if (user.getPerm("logincookie","").equals(loginCookieValue)) {
//cookie is present and correct - log the user in
data.setUser(user);
user.setHasLoggedIn(new Boolean(true));
user.updateLastLogin();
data.save();
}
} catch (LoginException noSuchUser) {
//user not found - ignore it - they will not be logged in automatically
} catch (org.apache.jetspeed.services.security.UnknownUserException unknownUser) {
//user not found - ignore it - they will not be logged in automatically
logger.warn("Username from the cookie was not found: " + userName);
} catch (Exception other){
logger.error(other);
}
}
}
}
// now, define Jetspeed specific properties, using the customized
// RunData properties
JetspeedRunData jdata = null;
try
{
jdata = (JetspeedRunData)data;
}
catch (ClassCastException e)
{
logger.error("The RunData object does not implement the expected interface, "
+ "please verify the RunData factory settings", e);
return;
}
String language = (String) data.getRequest().getParameter("js_language");
if (null != language)
{
user.setPerm("language", language);
}
// Get the locale store it in the user object
CustomLocalizationService locService = (CustomLocalizationService) ServiceUtil.getServiceByName(
LocalizationService.SERVICE_NAME);