* The super exists so just update it
*/
if (isSuperUserCreationSupported(udb)) {
// (Probably) Already exists, just update
udb.updateAccount(user, email, user.getFullname(), user.getRoles());
l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.superUserUpdated"));
}
} catch (Exception unfe) {
if (isSuperUserCreationSupported(udb)) {
udb.createAccount(superUser, superUserPassword, email, "Super User", new Role[] {});
l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.superUserCreated"));
user = udb.getAccount(superUser);
resetUser(request, user);
}
}
Property.setProperty(new RealmKey("security.administrators", user.getRealm().getResourceId()), superUser, seq
.getSession());
/*
* Set the super user password
*/
if (udb.supportsPasswordChange() && !superUserPassword.equals("")) {
udb.changePassword(superUser, "", superUserPassword, false);
l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.superUserPasswordSet"));
}
} catch (PasswordPolicyViolationException e) {
log.error("Failed to configure super user.", e);
l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_WITH_ERRORS,
"installation.install.status.failedToInstallExtension.password"));
} catch (Exception e) {
log.error("Failed to configure super user.", e);
l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_WITH_ERRORS,
"installation.install.status.failedToConfigureSuperUser", e.getMessage()));
}
return l;
}