IDEMPIERE-3465 Improve Remember Me on browser

This commit is contained in:
Carlos Ruiz 2017-08-30 17:17:32 +02:00
parent e287b987c2
commit 8c32a68349
3 changed files with 3 additions and 14 deletions

View File

@ -266,15 +266,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
//update session context
currSess.setAttribute(SessionContextListener.SESSION_CTX, ServerContext.getCurrentInstance());
if ("Y".equalsIgnoreCase(Env.getContext(ctx, BrowserToken.REMEMBER_ME)) && MSystem.isZKRememberUserAllowed())
{
MUser user = MUser.get(ctx);
BrowserToken.save(mSession, user);
}
else
{
BrowserToken.remove();
}
MUser user = MUser.get(ctx);
BrowserToken.save(mSession, user);
Env.setContext(ctx, "#UIClient", "zk");
StringBuilder localHttpAddr = new StringBuilder(Executions.getCurrent().getScheme());
@ -508,7 +501,6 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Env.setContext(properties, Env.AD_ROLE_ID, Env.getAD_Role_ID(Env.getCtx()));
Env.setContext(properties, Env.AD_ORG_NAME, Env.getContext(Env.getCtx(), Env.AD_ORG_NAME));
Env.setContext(properties, Env.M_WAREHOUSE_ID, Env.getContext(Env.getCtx(), Env.M_WAREHOUSE_ID));
Env.setContext(properties, BrowserToken.REMEMBER_ME, Env.getContext(Env.getCtx(), BrowserToken.REMEMBER_ME));
Env.setContext(properties, UserPreference.LANGUAGE_NAME, Env.getContext(Env.getCtx(), UserPreference.LANGUAGE_NAME));
Env.setContext(properties, Env.LANGUAGE, Env.getContext(Env.getCtx(), Env.LANGUAGE));
Env.setContext(properties, AEnv.LOCALE, Env.getContext(Env.getCtx(), AEnv.LOCALE));

View File

@ -164,6 +164,7 @@ public class LoginPanel extends Window implements EventListener<Event>
String token = data[1];
if (BrowserToken.validateToken(session, user, token))
{
onUserIdChange(AD_User_ID);
if (MSystem.isZKRememberUserAllowed()) {
if (email_login) {
txtUserId.setValue(user.getEMail());
@ -174,7 +175,6 @@ public class LoginPanel extends Window implements EventListener<Event>
txtUserId.setValue(user.getName());
}
}
onUserIdChange(AD_User_ID);
chkRememberMe.setChecked(true);
}
if (MSystem.isZKRememberPasswordAllowed()) {
@ -567,8 +567,6 @@ public class LoginPanel extends Window implements EventListener<Event>
}
}
Env.setContext(ctx, BrowserToken.REMEMBER_ME, chkRememberMe.isChecked());
Session currSess = Executions.getCurrent().getDesktop().getSession();
KeyNamePair clientsKNPairs[] = login.getClients(userId, userPassword);

View File

@ -40,7 +40,6 @@ public final class BrowserToken {
private BrowserToken() {}
public final static String REMEMBER_ME = "Login.RememberMe";
/**
* save session and user as client side token for future auto login
* @param session