IDEMPIERE-358 Login- how to make unique and safe - chose Option 1 (sysconfig parameter to use email as login) / Fix problem with remember me disabled, fix problem with multi-tenant and check context
This commit is contained in:
parent
cdafec1522
commit
d29d3c17e3
|
@ -204,7 +204,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
|
||||||
HttpSession httpSess = (HttpSession) currSess.getNativeSession();
|
HttpSession httpSess = (HttpSession) currSess.getNativeSession();
|
||||||
|
|
||||||
MSession mSession = MSession.get (ctx, currSess.getRemoteAddr(),
|
MSession mSession = MSession.get (ctx, currSess.getRemoteAddr(),
|
||||||
currSess.getRemoteHost(), httpSess.getId() );
|
currSess.getRemoteHost(), httpSess.getId() );
|
||||||
|
|
||||||
|
currSess.setAttribute("Check_AD_User_ID", Env.getAD_User_ID(ctx));
|
||||||
|
|
||||||
//enable full interface, relook into this when doing preference
|
//enable full interface, relook into this when doing preference
|
||||||
Env.setContext(ctx, "#ShowTrl", true);
|
Env.setContext(ctx, "#ShowTrl", true);
|
||||||
|
|
|
@ -94,6 +94,8 @@ public class RolePanel extends Window implements EventListener, Deferrable
|
||||||
private String m_userName;
|
private String m_userName;
|
||||||
/** Password */
|
/** Password */
|
||||||
private KeyNamePair[] m_clientKNPairs;
|
private KeyNamePair[] m_clientKNPairs;
|
||||||
|
|
||||||
|
private UserPreference m_userpreference=null;
|
||||||
|
|
||||||
private boolean m_show = true;
|
private boolean m_show = true;
|
||||||
|
|
||||||
|
@ -104,6 +106,13 @@ public class RolePanel extends Window implements EventListener, Deferrable
|
||||||
login = new Login(ctx);
|
login = new Login(ctx);
|
||||||
m_show = show;
|
m_show = show;
|
||||||
m_clientKNPairs = clientsKNPairs;
|
m_clientKNPairs = clientsKNPairs;
|
||||||
|
|
||||||
|
if( m_clientKNPairs.length == 1 && !m_show ){
|
||||||
|
Env.setContext(m_ctx, "#AD_Client_ID", (String) m_clientKNPairs[0].getID());
|
||||||
|
MUser user = MUser.get (m_ctx, m_userName);
|
||||||
|
m_userpreference=new UserPreference();
|
||||||
|
m_userpreference.loadPreference(user.get_ID());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
initComponents();
|
initComponents();
|
||||||
|
@ -304,6 +313,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
|
||||||
// initial client - Elaine 2009/02/06
|
// initial client - Elaine 2009/02/06
|
||||||
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
||||||
String initDefault = userPreference.getProperty(UserPreference.P_CLIENT);
|
String initDefault = userPreference.getProperty(UserPreference.P_CLIENT);
|
||||||
|
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
|
||||||
|
{
|
||||||
|
initDefault=m_userpreference.getProperty( UserPreference.P_CLIENT );
|
||||||
|
}
|
||||||
if (m_clientKNPairs != null && m_clientKNPairs.length > 0)
|
if (m_clientKNPairs != null && m_clientKNPairs.length > 0)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < m_clientKNPairs.length; i++)
|
for(int i = 0; i < m_clientKNPairs.length; i++)
|
||||||
|
@ -342,6 +355,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
|
||||||
// initial role
|
// initial role
|
||||||
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
||||||
String initDefault = userPreference.getProperty(UserPreference.P_ROLE);
|
String initDefault = userPreference.getProperty(UserPreference.P_ROLE);
|
||||||
|
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
|
||||||
|
{
|
||||||
|
initDefault=m_userpreference.getProperty( UserPreference.P_ROLE );
|
||||||
|
}
|
||||||
KeyNamePair clientKNPair = new KeyNamePair(new Integer((String)lstItemClient.getValue()), lstItemClient.getLabel());
|
KeyNamePair clientKNPair = new KeyNamePair(new Integer((String)lstItemClient.getValue()), lstItemClient.getLabel());
|
||||||
KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair);
|
KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair);
|
||||||
if (roleKNPairs != null && roleKNPairs.length > 0)
|
if (roleKNPairs != null && roleKNPairs.length > 0)
|
||||||
|
@ -391,6 +408,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
|
||||||
// initial organisation - Elaine 2009/02/06
|
// initial organisation - Elaine 2009/02/06
|
||||||
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
||||||
String initDefault = userPreference.getProperty(UserPreference.P_ORG);
|
String initDefault = userPreference.getProperty(UserPreference.P_ORG);
|
||||||
|
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
|
||||||
|
{
|
||||||
|
initDefault=m_userpreference.getProperty( UserPreference.P_ORG );
|
||||||
|
}
|
||||||
KeyNamePair RoleKNPair = new KeyNamePair(new Integer((String)lstItemRole.getValue()), lstItemRole.getLabel());
|
KeyNamePair RoleKNPair = new KeyNamePair(new Integer((String)lstItemRole.getValue()), lstItemRole.getLabel());
|
||||||
KeyNamePair orgKNPairs[] = login.getOrgs(RoleKNPair);
|
KeyNamePair orgKNPairs[] = login.getOrgs(RoleKNPair);
|
||||||
if(orgKNPairs != null && orgKNPairs.length > 0)
|
if(orgKNPairs != null && orgKNPairs.length > 0)
|
||||||
|
@ -423,6 +444,10 @@ public class RolePanel extends Window implements EventListener, Deferrable
|
||||||
// initial warehouse - Elaine 2009/02/06
|
// initial warehouse - Elaine 2009/02/06
|
||||||
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
UserPreference userPreference = SessionManager.getSessionApplication().getUserPreference();
|
||||||
String initDefault = userPreference.getProperty(UserPreference.P_WAREHOUSE);
|
String initDefault = userPreference.getProperty(UserPreference.P_WAREHOUSE);
|
||||||
|
if( initDefault.length() == 0 && !m_show && m_userpreference != null )
|
||||||
|
{
|
||||||
|
initDefault=m_userpreference.getProperty( UserPreference.P_WAREHOUSE );
|
||||||
|
}
|
||||||
KeyNamePair organisationKNPair = new KeyNamePair(new Integer((String)lstItemOrganisation.getValue()), lstItemOrganisation.getLabel());
|
KeyNamePair organisationKNPair = new KeyNamePair(new Integer((String)lstItemOrganisation.getValue()), lstItemOrganisation.getLabel());
|
||||||
KeyNamePair warehouseKNPairs[] = login.getWarehouses(organisationKNPair);
|
KeyNamePair warehouseKNPairs[] = login.getWarehouses(organisationKNPair);
|
||||||
if(warehouseKNPairs != null && warehouseKNPairs.length > 0)
|
if(warehouseKNPairs != null && warehouseKNPairs.length > 0)
|
||||||
|
|
Loading…
Reference in New Issue