IDEMPIERE-374 Change password must be changed to be a form instead of a process

This commit is contained in:
Carlos Ruiz 2012-09-19 13:02:33 -05:00
parent 7e3a7baa71
commit 6b2545bf7f
2 changed files with 31 additions and 2 deletions

View File

@ -265,6 +265,13 @@ public class VResetPassword implements FormPanel, ActionListener, VetoableChange
return;
}
}
if (MSysConfig.getBooleanValue(MSysConfig.CHANGE_PASSWORD_MUST_DIFFER, true))
{
if (p_OldPassword.equals(p_NewPassword)) {
ADialog.error(windowNo, frame, "NewPasswordMustDiffer");
return;
}
}
}
// new password confirm
@ -301,7 +308,15 @@ public class VResetPassword implements FormPanel, ActionListener, VetoableChange
if (!Util.isEmpty(p_NewEMailUserPW))
user.setEMailUserPW(p_NewEMailUserPW);
user.saveEx();
try {
user.saveEx();
}
catch(Exception e)
{
ADialog.error(windowNo, frame, e.getLocalizedMessage());
user.load(user.get_TrxName());
return;
}
clearForm();
ADialog.info(windowNo, frame, "RecordSaved");
return;

View File

@ -16,6 +16,7 @@ package org.adempiere.webui.apps.form;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.AdempiereIdGenerator;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.ConfirmPanel;
@ -294,6 +295,12 @@ public class WResetPassword implements IFormController, EventListener, ValueChan
if (!p_OldPassword.equals(user.getPassword()))
throw new IllegalArgumentException(Msg.getMsg(Env.getCtx(), "OldPasswordNoMatch"));
}
if (MSysConfig.getBooleanValue(MSysConfig.CHANGE_PASSWORD_MUST_DIFFER, true))
{
if (p_OldPassword.equals(p_NewPassword)) {
throw new IllegalArgumentException(Msg.getMsg(Env.getCtx(), "NewPasswordMustDiffer"));
}
}
}
// new password confirm
@ -326,7 +333,14 @@ public class WResetPassword implements IFormController, EventListener, ValueChan
if (!Util.isEmpty(p_NewEMailUserPW))
user.setEMailUserPW(p_NewEMailUserPW);
user.saveEx();
try {
user.saveEx();
}
catch(AdempiereException e)
{
user.load(user.get_TrxName());
throw e;
}
clearForm();
FDialog.info(form.getWindowNo(), form, "RecordSaved");
return;