UserDAO dao = UserDAO.getInstance();
PendingRegistrationForm pprForm = (PendingRegistrationForm) form;
try {
ProfileForm profile = new ProfileForm();
profile.setLogin(pprForm.getLogin());
profile.setEmail(pprForm.getEmail());
String password = dao.generatePassword();
profile.setPassword(password);
profile.setPassword2(password);
if (dao.checkPendingUser(pprForm.getLogin(), pprForm.getCode())
&& dao.addUser(profile)) {
dao.deletePendingUser(pprForm.getLogin());
User newuser = dao.getUser(profile.getLogin(), profile
.getPassword());
log(request, "logs.LOG7", newuser.getName());
if (newuser.getStatus() > 0) {
newuser.setIp(request.getRemoteAddr());
session.setAttribute(IConst.SESSION.USER_KEY, newuser);
/*
* MailMessage(String messagetext, String subject, String
* addrfrom, String namefrom, String addrto, String nameto)
*/
MessageResources messages = getResources(request);
Configurator config = Configurator.getInstance();
/*
* {0} - login {1} - new password {2} - site url {3} - site
* name
*/
StringBuffer siteUrl = new StringBuffer();
siteUrl.append(request.getServerName());
siteUrl.append(":");
siteUrl.append(request.getServerPort());
siteUrl.append(request.getContextPath());
siteUrl.append(config.get(IConst.CONFIG.MODULE_PREFIX));
siteUrl.append("/");
Object[] messArgs = new Object[] { newuser.getName(),
profile.getPassword(), siteUrl.toString(),
config.get(IConst.CONFIG.SITE_NAME) };
MailQueue queue = (MailQueue) session.getServletContext()
.getAttribute(IConst.CONTEXT.MAIL_QUEUE);
queue.push(new MailMessage(messages.getMessage(