X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.e4.rap%2Fsrc%2Forg%2Fargeo%2Fcms%2Fe4%2Frap%2FCmsLoginLifecycle.java;h=615a98117f0b49fb5ba047b5af7ff875210d090f;hb=8267fad4498b78552b784dcbcb7f9e03a53ee4ba;hp=6872906260209d51588a0c4833e721ccb2795aa1;hpb=6ba130a04c057858b151d5d460b8c95976bd619b;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java index 687290626..615a98117 100644 --- a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java +++ b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java @@ -6,6 +6,8 @@ import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.argeo.cms.CmsException; import org.argeo.cms.auth.CurrentUser; import org.argeo.cms.ui.CmsImageManager; @@ -15,15 +17,17 @@ import org.argeo.cms.util.SimpleUxContext; import org.argeo.cms.widgets.auth.CmsLoginShell; import org.argeo.node.NodeConstants; import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate; +import org.eclipse.e4.ui.workbench.lifecycle.PreSave; import org.eclipse.swt.widgets.Display; @SuppressWarnings("restriction") public class CmsLoginLifecycle implements CmsView { + private final static Log log = LogFactory.getLog(CmsLoginLifecycle.class); private UxContext uxContext; private LoginContext loginContext; @PostContextCreate - boolean login(Display d) { + boolean login() { Subject subject = Subject.getSubject(AccessController.getContext()); Display display = Display.getCurrent(); CmsLoginShell loginShell = new CmsLoginShell(this); @@ -44,9 +48,16 @@ public class CmsLoginLifecycle implements CmsView { if (CurrentUser.getUsername(getSubject()) == null) return false; uxContext = new SimpleUxContext(); + + // lcs.changeApplicationLocale(Locale.FRENCH); return true; } + @PreSave + void destroy() { + //logout(); + } + @Override public UxContext getUxContext() { return uxContext; @@ -63,12 +74,12 @@ public class CmsLoginLifecycle implements CmsView { if (loginContext == null) throw new CmsException("Login context cannot be null"); // logout previous login context -// if (this.loginContext != null) -// try { -// this.loginContext.logout(); -// } catch (LoginException e1) { -// System.err.println("Could not log out: " + e1); -// } + // if (this.loginContext != null) + // try { + // this.loginContext.logout(); + // } catch (LoginException e1) { + // System.err.println("Could not log out: " + e1); + // } this.loginContext = loginContext; } @@ -86,8 +97,7 @@ public class CmsLoginLifecycle implements CmsView { @Override public void exception(Throwable e) { - // TODO Auto-generated method stub - + log.error("Unexpected exception in Eclipse 4 RAP", e); } @Override