DynaActionForm f = (DynaActionForm)form;
String strForward = null;
String clufAccepted = f.getString(Params.REGISTER.CLUF.VALIDATE.PARAMS.CLUF_ACCEPTED);
String buyerId = request.getParameter(Params.REGISTER.CLUF.VALIDATE.PARAMS.BUYER_ID);
InvitationInfo invitInfo = (InvitationInfo) request.getSession().getAttribute(Params.REGISTER.SESSION.INVITATION_INFORMATION);
if (buyerId != null) {
// A trial user want to buy a license
// We build the registration
User user = Portal.getInstance().getUserService().getUserById(buyerId);
org.jayasoft.woj.portal.model.registration.Registration reg = new org.jayasoft.woj.portal.model.registration.Registration();
reg.setUser(user);
request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION, reg);
request.getSession().setAttribute(Params.REGISTER.SESSION.BUYER_ID, buyerId);
// We consider that we are modifying a existing user.
request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID, buyerId);
clufAccepted = "1";
} else if (invitInfo != null) {
// Invitation case
if ("1".equals(clufAccepted)) {
LOGGER.debug("user has accepted the license");
String adminId = invitInfo.getAdminId();
User admin = ServiceFactory.getUserService().getUserById(adminId);
ServiceFactory.getLicenseService().acceptInvitation(invitInfo);
request.setAttribute(Params.REGISTER.INVITATION_SUCCEED.REQUEST.ADMIN_MAIL, admin.getEmail());
request.getSession().removeAttribute(Params.REGISTER.SESSION.CURRENT_REGISTRATION);
request.getSession().removeAttribute(Params.REGISTER.SESSION.INVITATION_INFORMATION);