X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui.workbench%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Fworkbench%2Fcommands%2FOpenChangePasswordDialog.java;h=30836b948c19593f6fd15661524b568861c2785f;hb=5b444174cd13680f99944026877f6cac2e1faba1;hp=64f4ff9b800f1b1f15990b55d2c94b9d9f84be2b;hpb=e85f259de1f77b38c5c9abd7eacfa74c7f571fdb;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/commands/OpenChangePasswordDialog.java b/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/commands/OpenChangePasswordDialog.java index 64f4ff9b8..30836b948 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/commands/OpenChangePasswordDialog.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/commands/OpenChangePasswordDialog.java @@ -35,6 +35,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.argeo.cms.CmsException; import org.argeo.eclipse.ui.dialogs.ErrorFeedback; +import org.argeo.node.security.CryptoKeyring; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -59,6 +60,7 @@ public class OpenChangePasswordDialog extends AbstractHandler { private final static Log log = LogFactory.getLog(OpenChangePasswordDialog.class); private UserAdmin userAdmin; private UserTransaction userTransaction; + private CryptoKeyring keyring = null; public Object execute(ExecutionEvent event) throws ExecutionException { ChangePasswordDialog dialog = new ChangePasswordDialog(HandlerUtil.getActiveShell(event), userAdmin); @@ -87,6 +89,10 @@ public class OpenChangePasswordDialog extends AbstractHandler { try { userTransaction.begin(); user.getCredentials().put(null, newPassword); + if (keyring != null) { + keyring.changePassword(oldPassword, newPassword); + // TODO change secret keys in the CMS session + } userTransaction.commit(); } catch (Exception e) { try { @@ -162,4 +168,9 @@ public class OpenChangePasswordDialog extends AbstractHandler { public void setUserTransaction(UserTransaction userTransaction) { this.userTransaction = userTransaction; } + + public void setKeyring(CryptoKeyring keyring) { + this.keyring = keyring; + } + }