IDEMPIERE-373 Implement User Locking / Improve error messages

This commit is contained in:
David Peñuela 2013-01-22 21:55:48 -08:00
parent d8ab6df543
commit 5eb035dfac
5 changed files with 36 additions and 5 deletions

View File

@ -0,0 +1,13 @@
-- Jan 17, 2013 5:41:53 PM COT
--
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Invalid User ID or Password',200135,'D','39bde5a5-da86-4147-a5de-433003a66976','FailedLogin','Y',TO_DATE('2013-01-17 17:41:51','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_DATE('2013-01-17 17:41:51','YYYY-MM-DD HH24:MI:SS'))
;
-- Jan 17, 2013 5:41:53 PM COT
--
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200135 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('201301181034_TICKET-1002007.sql') FROM dual
;

View File

@ -0,0 +1,13 @@
-- Jan 17, 2013 5:41:53 PM COT
--
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,AD_Client_ID,AD_Org_ID,Created) VALUES ('E','Invalid User ID or Password',200135,'D','39bde5a5-da86-4147-a5de-433003a66976','FailedLogin','Y',TO_TIMESTAMP('2013-01-17 17:41:51','YYYY-MM-DD HH24:MI:SS'),0,0,0,0,TO_TIMESTAMP('2013-01-17 17:41:51','YYYY-MM-DD HH24:MI:SS'))
;
-- Jan 17, 2013 5:41:53 PM COT
--
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200135 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;
SELECT register_migration_script('201301181034_TICKET-1002007.sql') FROM dual
;

View File

@ -1443,9 +1443,14 @@ public class Login
} }
else if (MAX_LOGIN_ATTEMPT > 0) else if (MAX_LOGIN_ATTEMPT > 0)
{ {
if (count == MAX_LOGIN_ATTEMPT -1){
// Invalid User ID or Password (Login Attempts: {0} / {1}) // Invalid User ID or Password (Login Attempts: {0} / {1})
loginErrMsg = Msg.getMsg(m_ctx, "FailedLoginAttempt", new Object[] {count, MAX_LOGIN_ATTEMPT}); loginErrMsg = Msg.getMsg(m_ctx, "FailedLoginAttempt", new Object[] {count, MAX_LOGIN_ATTEMPT});
reachMaxAttempt = false; reachMaxAttempt = false;
}else{
loginErrMsg = Msg.getMsg(m_ctx,"FailedLogin", true);
}
} }
else else
{ {

View File

@ -147,7 +147,7 @@ public class AdempiereMonitorFilter implements Filter
MUser user = MUser.get(Env.getCtx(), name, password); MUser user = MUser.get(Env.getCtx(), name, password);
if (user == null) if (user == null)
{ {
log.warning ("User not found: '" + name + "/" + password + "'"); log.warning ("User not found: '" + name);
return false; return false;
} }
if (!user.isAdministrator()) if (!user.isAdministrator())

View File

@ -528,7 +528,7 @@ public class LoginPanel extends Window implements EventListener<Event>
if (loginErrMsg != null && loginErrMsg.length() > 0) if (loginErrMsg != null && loginErrMsg.length() > 0)
throw new WrongValueException(loginErrMsg); throw new WrongValueException(loginErrMsg);
else else
throw new WrongValueException("User Id or Password invalid!!!"); throw new WrongValueException(Msg.getMsg(ctx,"FailedLogin", true));
} }
else else
{ {