diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 35ae874def..441806452e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -81,7 +81,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb /** * */ - private static final long serialVersionUID = 5616730124927184116L; + private static final long serialVersionUID = -208259686238044047L; private static final String SAVED_CONTEXT = "saved.context"; @@ -358,7 +358,8 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb Session session = Executions.getCurrent().getDesktop().getSession(); //stop background thread - appDesktop.logout(); + if (appDesktop != null) + appDesktop.logout(); //clear remove all children and root component getChildren().clear(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index 9a821fd5d0..74616f35cb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -76,7 +76,7 @@ public class RolePanel extends Window implements EventListener, Deferrable /** * */ - private static final long serialVersionUID = 153231955030136145L; + private static final long serialVersionUID = 4403663665119775251L; private static final String RESOURCE = "org.compiere.apps.ALoginRes"; @@ -465,6 +465,7 @@ public class RolePanel extends Window implements EventListener, Deferrable } else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL)) { + SessionManager.logoutSession(); wndLogin.loginCancelled(); } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java index 678f8a117b..3d537b35c5 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java @@ -30,6 +30,7 @@ import org.adempiere.webui.IWebClient; import org.adempiere.webui.component.FWindow; import org.adempiere.webui.panel.LoginPanel; import org.adempiere.webui.panel.RolePanel; +import org.compiere.model.MSysConfig; import org.compiere.model.MUser; import org.compiere.util.Env; import org.compiere.util.KeyNamePair; @@ -53,7 +54,8 @@ public class LoginWindow extends FWindow implements EventListener /** * */ - private static final long serialVersionUID = -6312322926432586415L; + private static final long serialVersionUID = -5169830531440825871L; + private IWebClient app; private Properties ctx; private LoginPanel pnlLogin; @@ -130,7 +132,14 @@ public class LoginWindow extends FWindow implements EventListener getDesktop().getSession().setAttribute(Attributes.PREFERRED_LOCALE, locale); Locales.setThreadLocal(locale); Login login = new Login(Env.getCtx()); - loginOk(MUser.getNameOfUser(Env.getAD_User_ID(ctx)), true, login.getClients()); + MUser user = MUser.get(ctx, Env.getAD_User_ID(ctx)); + String loginName; + boolean email_login = MSysConfig.getBooleanValue(MSysConfig.USE_EMAIL_FOR_LOGIN, false); + if (email_login) + loginName = user.getEMail(); + else + loginName = user.getLDAPUser() != null ? user.getLDAPUser() : user.getName(); + loginOk(loginName, true, login.getClients()); getDesktop().getSession().setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx)); pnlRole.changeRole(ctx);