if (!accountExists)
{
Date now = new Date();
JetspeedUser user = JetspeedSecurity.getUserInstance();
user.setUserName( username );
user.setCreateDate(now);
user.setLastLogin(new Date(0));
user.setFirstName( data.getParameters().getString("firstname") );
user.setLastName( data.getParameters().getString("lastname") );
user.setEmail( data.getParameters().getString("email") );
createUser(user, data);
// create a unique confirmation string for the new user
String confirmValue = GenerateUniqueId.getIdentifier();
// allow for disabling of email for configurations without a mail server
boolean newUserNotification = JetspeedResources.getBoolean("newuser.notification.enable", false);
boolean newUserApproval = JetspeedResources.getBoolean("newuser.approval.enable", false);
boolean enableMail = JetspeedResources.getBoolean("newuser.confirm.enable", false);
if (false == enableMail)
confirmValue = JetspeedResources.CONFIRM_VALUE;
if (true == newUserApproval)
confirmValue = JetspeedResources.CONFIRM_VALUE_PENDING;
user.setConfirmed( confirmValue );
// Store the user object.
data.setUser(user);
user.setPassword(pass1);
JetspeedSecurity.addUser(user);
if (!enableMail && !newUserApproval)
{
user.setHasLoggedIn(new Boolean (true));
user.setLastLogin(new Date(0));
}
data.setMessage(Localization.getString(data, "CREATENEWUSERANDCONFIRM_CREATE"));
if (enableMail || newUserNotification || newUserApproval)
{
data.setUser(JetspeedSecurity.getAnonymousUser());