IDEMPIERE-2549 Password rule break Initial Client Setup

This commit is contained in:
Carlos Ruiz 2015-04-15 12:42:42 -05:00
parent 804116fe13
commit 7d01f70a64
5 changed files with 132 additions and 5 deletions

View File

@ -0,0 +1,55 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
update ad_process_para set seqno=seqno+1000 where ad_process_id=53161 and seqno>=80;
update ad_process_para set seqno=seqno-990 where ad_process_id=53161 and seqno>=1080;
-- IDEMPIERE-2549 Password rule break Initial Client Setup
-- Apr 15, 2015 12:17:41 PM COT
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202876,0,0,'Y',TO_DATE('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,'IsSetInitialPassword','IsSetInitialPassword','IsSetInitialPassword','D','0e03fdbc-cb25-4705-bbd8-4442b02563af')
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Element SET Name='Set Initial Password', PrintName='Set Initial Password',Updated=TO_DATE('2015-04-15 12:17:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202876
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Column SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL, AD_Element_ID=202876 WHERE UPPER(ColumnName)='ISSETINITIALPASSWORD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y'
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_InfoColumn SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y'
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Field SET Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202876) AND IsCentrallyMaintained='Y'
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Set Initial Password', Name='Set Initial Password' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=202876)
;
-- Apr 15, 2015 12:18:34 PM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200132,0,0,'Y',TO_DATE('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,'Set Initial Password',53161,80,20,'N',1,'Y','Y','IsSetInitialPassword','Y','D',202876,'54bfb648-044e-47d3-b232-bb61a4632772','N')
;
-- Apr 15, 2015 12:19:10 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_DATE('2015-04-15 12:19:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=288
;
-- Apr 15, 2015 12:36:59 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Force change on next login',0,0,'Y',TO_DATE('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,200349,'ForceChangeOnNextLogin','D','ef609a89-2d65-44f8-8aaf-4a29854510c9')
;
SELECT register_migration_script('201504151220_IDEMPIERE-2549.sql') FROM dual
;

View File

@ -0,0 +1,52 @@
update ad_process_para set seqno=seqno+1000 where ad_process_id=53161 and seqno>=80;
update ad_process_para set seqno=seqno-990 where ad_process_id=53161 and seqno>=1080;
-- IDEMPIERE-2549 Password rule break Initial Client Setup
-- Apr 15, 2015 12:17:41 PM COT
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (202876,0,0,'Y',TO_TIMESTAMP('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-15 12:17:40','YYYY-MM-DD HH24:MI:SS'),100,'IsSetInitialPassword','IsSetInitialPassword','IsSetInitialPassword','D','0e03fdbc-cb25-4705-bbd8-4442b02563af')
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Element SET Name='Set Initial Password', PrintName='Set Initial Password',Updated=TO_TIMESTAMP('2015-04-15 12:17:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=202876
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Column SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL, AD_Element_ID=202876 WHERE UPPER(ColumnName)='ISSETINITIALPASSWORD' AND IsCentrallyMaintained='Y' AND AD_Element_ID IS NULL
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Process_Para SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y'
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_InfoColumn SET ColumnName='IsSetInitialPassword', Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Element_ID=202876 AND IsCentrallyMaintained='Y'
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_Field SET Name='Set Initial Password', Description=NULL, Help=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=202876) AND IsCentrallyMaintained='Y'
;
-- Apr 15, 2015 12:17:58 PM COT
UPDATE AD_PrintFormatItem SET PrintName='Set Initial Password', Name='Set Initial Password' WHERE IsCentrallyMaintained='Y' AND EXISTS (SELECT * FROM AD_Column c WHERE c.AD_Column_ID=AD_PrintFormatItem.AD_Column_ID AND c.AD_Element_ID=202876)
;
-- Apr 15, 2015 12:18:34 PM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200132,0,0,'Y',TO_TIMESTAMP('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-15 12:18:34','YYYY-MM-DD HH24:MI:SS'),100,'Set Initial Password',53161,80,20,'N',1,'Y','Y','IsSetInitialPassword','Y','D',202876,'54bfb648-044e-47d3-b232-bb61a4632772','N')
;
-- Apr 15, 2015 12:19:10 PM COT
UPDATE AD_Process SET IsActive='N',Updated=TO_TIMESTAMP('2015-04-15 12:19:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=288
;
-- Apr 15, 2015 12:36:59 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('I','Force change on next login',0,0,'Y',TO_TIMESTAMP('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-04-15 12:36:59','YYYY-MM-DD HH24:MI:SS'),100,200349,'ForceChangeOnNextLogin','D','ef609a89-2d65-44f8-8aaf-4a29854510c9')
;
SELECT register_migration_script('201504151220_IDEMPIERE-2549.sql') FROM dual
;

View File

@ -62,6 +62,7 @@ public class InitialClientSetup extends SvrProcess
private String p_OrgName = null;
private String p_AdminUserName = null;
private String p_NormalUserName = null;
private boolean p_IsSetInitialPassword = true;
private int p_C_Currency_ID = 0;
private int p_C_Country_ID = 0;
private int p_C_Region_ID = 0;
@ -110,6 +111,8 @@ public class InitialClientSetup extends SvrProcess
p_AdminUserName = (String) para[i].getParameter();
else if (name.equals("NormalUserName"))
p_NormalUserName = (String) para[i].getParameter();
else if (name.equals("IsSetInitialPassword"))
p_IsSetInitialPassword = para[i].getParameterAsBoolean();
else if (name.equals("C_Currency_ID"))
p_C_Currency_ID = para[i].getParameterAsInt();
else if (name.equals("C_Country_ID"))
@ -175,6 +178,7 @@ public class InitialClientSetup extends SvrProcess
.append(", OrgName=").append(p_OrgName)
.append(", AdminUserName=").append(p_AdminUserName)
.append(", NormalUserName=").append(p_NormalUserName)
.append(", IsSetInitialPassword=").append(p_IsSetInitialPassword)
.append(", C_Currency_ID=").append(p_C_Currency_ID)
.append(", C_Country_ID=").append(p_C_Country_ID)
.append(", C_Region_ID=").append(p_C_Region_ID)
@ -259,7 +263,7 @@ public class InitialClientSetup extends SvrProcess
MSetup ms = new MSetup(Env.getCtx(), WINDOW_THIS_PROCESS);
try {
if (! ms.createClient(p_ClientName, p_OrgValue, p_OrgName, p_AdminUserName, p_NormalUserName
, p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail)) {
, p_Phone, p_Phone2, p_Fax, p_EMail, p_TaxID, p_AdminUserEmail, p_NormalUserEmail, p_IsSetInitialPassword)) {
ms.rollback();
throw new AdempiereException("Create client failed");
}

View File

@ -108,11 +108,12 @@ public final class MSetup
* @param orgName org name
* @param userClient user id client
* @param userOrg user id org
* @param isSetInitialPassword
* @return true if created
*/
public boolean createClient (String clientName, String orgValue, String orgName,
String userClient, String userOrg, String phone, String phone2, String fax, String eMail, String taxID,
String adminEmail, String userEmail)
String adminEmail, String userEmail, boolean isSetInitialPassword)
{
log.info(clientName);
m_trx.start();
@ -286,7 +287,8 @@ public final class MSetup
if (name == null || name.length() == 0)
name = m_clientName + "Client";
clientAdminUser.setPassword(name);
if (isSetInitialPassword)
clientAdminUser.setPassword(name);
clientAdminUser.setDescription(name);
clientAdminUser.setName(name);
clientAdminUser.setAD_Client_ID(AD_Client_ID);
@ -320,7 +322,8 @@ public final class MSetup
if (name == null || name.length() == 0)
name = m_clientName + "Org";
clientUser.setPassword(name);
if (isSetInitialPassword)
clientUser.setPassword(name);
clientUser.setDescription(name);
clientUser.setName(name);
clientUser.setAD_Client_ID(AD_Client_ID);

View File

@ -17,6 +17,7 @@ package org.adempiere.webui.apps.form;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid;
@ -75,6 +76,7 @@ public class WResetPassword implements IFormController, EventListener<Event>, Va
private Textbox txtOldPassword;
private Textbox txtNewPassword;
private Textbox txtRetypeNewPassword;
private Checkbox cbForceChangeNextLogin;
private Textbox txtNewEMail;
private Textbox txtNewEMailUser;
private Textbox txtNewEMailUserPW;
@ -144,7 +146,11 @@ public class WResetPassword implements IFormController, EventListener<Event>, Va
txtRetypeNewPassword.setType("password");
txtRetypeNewPassword.setCols(25);
txtRetypeNewPassword.setWidth("220px");
cbForceChangeNextLogin = new Checkbox();
cbForceChangeNextLogin.setLabel(Msg.getMsg(Env.getCtx(), "ForceChangeOnNextLogin"));
cbForceChangeNextLogin.setChecked(false);
txtNewEMail = new Textbox();
txtNewEMail.setId("txtNewEMail");
txtNewEMail.setCols(25);
@ -209,6 +215,11 @@ public class WResetPassword implements IFormController, EventListener<Event>, Va
row.appendChild(lblRetypeNewPassword.rightAlign());
row.appendChild(txtRetypeNewPassword);
row = new Row();
rows.appendChild(row);
row.appendChild(new Label());
row.appendChild(cbForceChangeNextLogin);
row = new Row();
rows.appendChild(row);
row.appendChild(lblNewEMail.rightAlign());
@ -327,6 +338,8 @@ public class WResetPassword implements IFormController, EventListener<Event>, Va
user.setEMailUser(p_NewEMailUser);
if (!Util.isEmpty(p_NewEMailUserPW))
user.setEMailUserPW(p_NewEMailUserPW);
if (cbForceChangeNextLogin.isChecked())
user.setIsExpired(true);
try {
user.saveEx();