else try
{
// Add new user
UserManager mgr = RollerFactory.getRoller().getUserManager();
UserData ud = new UserData();
form.copyTo(ud, request.getLocale()); // doesn't copy password
ud.setId(null);
ud.setDateCreated(new java.util.Date());
ud.setEnabled(Boolean.TRUE);
// If user set both password and passwordConfirm then reset password
if ( !StringUtils.isEmpty(form.getPasswordText())
&& !StringUtils.isEmpty(form.getPasswordConfirm()))
{
ud.resetPassword(RollerFactory.getRoller(),
form.getPasswordText(), form.getPasswordConfirm());
}
// save new user
mgr.addUser(ud);
RollerFactory.getRoller().flush();
if (form.getAdminCreated())
{
// User created for admin, so return to new user page with empty form
msgs.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("newUser.created"));
saveMessages(request, msgs);
form.reset(mapping, request);
return createUser(mapping, actionForm, request, response);
}
else
{
// User registered, so go to welcome page
String weblogURL = rollerContext.getAbsoluteContextUrl(request)
+ "/page/"+ud.getUserName();
request.setAttribute("weblogURL",weblogURL);
String rssURL = rollerContext.getAbsoluteContextUrl(request)
+ "/rss/"+ud.getUserName();
request.setAttribute("rssURL",rssURL);
request.setAttribute("contextURL",
rollerContext.getAbsoluteContextUrl(request));
return mapping.findForward("welcome.page");
}