public void createAction(UserModel user, String eMail) { VerifyMailActionData data = new VerifyMailActionData(); ActionResult create = actionService.createAction(this, data); if (create.wasSuccessfull()) { SimpleMailMessage message = new SimpleMailMessage(template); message.setTo(user.getEmail()); String body = texte.text("action.verify.mail.body"); body = body.replace("{link}", ActionResult.ACTION_URL); message.setText(body.toString()); mailer.sendMessage(create.getContentReplacer(), message); } }
void doExecute(ActionCreateUser data) { UserModel foundMail = userRepo.findByEmail(data.getEMail()); if (foundMail != null) { throw new ValidationException("eMail allready inuse"); } UserModel foundName = userRepo.findByName(data.getUserName()); if (foundName != null) { throw new ValidationException("Username allready inuse"); } AuthMapping foundLogin = authRepo.findByAuthIdAndAuthType(data.getLoginName(), LocalIdp.IDP_NAME); if (foundLogin != null) { throw new ValidationException("Login Name allready inuse"); } String body = texte.text("action.subscribe.confirm.mail.body"); if (body == null) { throw new ValidationException( "Missing Mail Body : key='action.subscribe.confirm.mail.body' "); } Collection<UserRoles> newRoles = new ArrayList<UserRoles>(); newRoles.add(UserRoles.USER); UserModel user = userService.createIdentity( data.getProvider(), data.getLoginName(), data.getUserName(), data.getPassword(), data.getEMail(), newRoles); // actionVerify.createAction(user, data.getEMail()); // Send confirmation mail String baseUrl = config.getStringValue("baseUrl"); body = body.replace("${username}", data.getUserName()); body = body.replace("${loginname}", data.getLoginName()); body = body.replace("${email}", data.getEMail()); body = body.replace("${baseUrl}", baseUrl); SimpleMailMessage message = new SimpleMailMessage(template); message.setTo(data.getEMail()); message.setText(body.toString()); mailer.sendMessage(message); }