Source:
<code>public void generatePassword(final WebContext ctx, String id) { UserAccount userAccount = findForTenant(UserAccount.class, id); assertNotNew(userAccount); if (!userAccount.isPasswordGenerationPossible()) { throw Exceptions.createHandled() .withNLSKey("UserAccountConroller.cannotGeneratePasswordForOwnUser") .handle(); } userAccount.getLogin().setGeneratedPassword(Strings.generatePassword()); oma.update(userAccount); auditLog.neutral("AuditLog.passwordGenerated") .causedByCurrentUser() .forUser(userAccount.getUniqueName(), userAccount.getLogin().getUsername()) .forTenant(String.valueOf(userAccount.getTenant().getId()), userAccount.getTenant().getValue().getName()) <START> .forCurrentUser() <END> .log(); if (userAccount.shouldSendGeneratedPassword()) { UserContext.message(Message.info(NLS.fmtr("UserAccountConroller.passwordGeneratedAndSent") .set(PARAM_EMAIL, userAccount.getEmail()) .format())); Context context = Context.create() .set(PARAM_PASSWORD, userAccount.getLogin().getGeneratedPassword()) .set(PARAM_NAME, userAccount.getPerson().getAddressableName()) .set(PARAM_USERNAME, userAccount.getLogin().getUsername()) .set(PARAM_URL, getBaseUrl()) .set(PARAM_ROOT, wondergemRoot); mails.createEmail() .to(userAccount.getEmail(), userAccount.getPerson().toString()) .subject(NLS.get("mail-password.subject")) .textTemplate("mail/useraccount/password.pasta", context) .htmlTemplate("mail/useraccount/password.html.pasta", context) .send(); } else { UserContext.message(Message.info(NLS.get("UserAccountConroller.passwordGenerated"))); } accounts(ctx); }</code><technical_language>This overwrites previously setted values</technical_language>

Target:
public void generatePassword(final WebContext ctx, String id) { UserAccount userAccount = findForTenant(UserAccount.class, id); assertNotNew(userAccount); if (!userAccount.isPasswordGenerationPossible()) { throw Exceptions.createHandled() .withNLSKey("UserAccountConroller.cannotGeneratePasswordForOwnUser") .handle(); } userAccount.getLogin().setGeneratedPassword(Strings.generatePassword()); oma.update(userAccount); auditLog.neutral("AuditLog.passwordGenerated") .causedByCurrentUser() .forUser(userAccount.getUniqueName(), userAccount.getLogin().getUsername()) .forTenant(String.valueOf(userAccount.getTenant().getId()), userAccount.getTenant().getValue().getName()) .log(); if (userAccount.shouldSendGeneratedPassword()) { UserContext.message(Message.info(NLS.fmtr("UserAccountConroller.passwordGeneratedAndSent") .set(PARAM_EMAIL, userAccount.getEmail()) .format())); Context context = Context.create() .set(PARAM_PASSWORD, userAccount.getLogin().getGeneratedPassword()) .set(PARAM_NAME, userAccount.getPerson().getAddressableName()) .set(PARAM_USERNAME, userAccount.getLogin().getUsername()) .set(PARAM_URL, getBaseUrl()) .set(PARAM_ROOT, wondergemRoot); mails.createEmail() .to(userAccount.getEmail(), userAccount.getPerson().toString()) .subject(NLS.get("mail-password.subject")) .textTemplate("mail/useraccount/password.pasta", context) .htmlTemplate("mail/useraccount/password.html.pasta", context) .send(); } else { UserContext.message(Message.info(NLS.get("UserAccountConroller.passwordGenerated"))); } accounts(ctx); }