/** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { Map<String, Object> actionParam = (Map<String, Object>) context .get(ActionContextConstants.ACTION_PARAM); char[] typedPasswd = (char[]) actionParam.get(PASSWD_TYPED); char[] retypedPasswd = (char[]) actionParam.get(PASSWD_RETYPED); if (!Arrays.equals(typedPasswd, retypedPasswd)) { throw new ActionBusinessException( "Typed and retyped passwords are different.", "password.typed.retyped.different"); } UserPrincipal principal = getApplicationSession(context).getPrincipal(); if (changePassword(principal, (char[]) actionParam.get(PASSWD_CURRENT), typedPasswd)) { context.put(ActionContextConstants.ACTION_PARAM, getTranslationProvider( context) .getTranslation("password.change.success", getLocale(context))); return super.execute(actionHandler, context); } return false; }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { Map<String, Object> actionParam = getModelConnector(context).getConnectorValue(); String typedPasswd = (String) actionParam.get(PASSWD_TYPED); String retypedPasswd = (String) actionParam.get(PASSWD_RETYPED); if (!ObjectUtils.equals(typedPasswd, retypedPasswd)) { throw new ActionBusinessException("Typed and retyped passwords are different.", "password.typed.retyped.different"); } checkPasswordValidity(typedPasswd, context); UserPrincipal principal = getApplicationSession(context).getPrincipal(); if (changePassword(principal, (String) actionParam.get(PASSWD_CURRENT), typedPasswd)) { setActionParameter(getTranslationProvider(context).getTranslation("password.change.success", getLocale(context)), context); return super.execute(actionHandler, context); } return false; }