| @@ -244,8 +244,9 @@ | ||
| 244 | 244 | // Guard: never persist orphan fields (in fields but in no layout) — they |
| 245 | 245 | // render nothing yet their validation rules block submission. Covers old |
| 246 | 246 | // clients and hand-edited imports (importAForm funnels through here). |
| 247 | 247 | $this->pruneOrphanFields($fields, $nestedLayout, $layout, null, $post); |
| 248 | + FormManager::syncCompositeChildNames($fields); | |
| 248 | 249 | $form_content = [ |
| 249 | 250 | 'fields' => $fields, |
| 250 | 251 | 'layout' => $layout, |
| 251 | 252 | 'nestedLayout' => $nestedLayout, |
| @@ -588,8 +589,9 @@ | ||
| 588 | 589 | } |
| 589 | 590 | |
| 590 | 591 | // Guard: never persist orphan fields (see createNewForm). Fail closed. |
| 591 | 592 | $this->pruneOrphanFields($fields, $nestedLayout, $layout, $formID, $post); |
| 593 | + FormManager::syncCompositeChildNames($fields); | |
| 592 | 594 | |
| 593 | 595 | $form_content = [ |
| 594 | 596 | 'fields' => $fields, |
| 595 | 597 | 'layout' => $layout, |
| @@ -2489,10 +2491,15 @@ | ||
| 2489 | 2491 | $layout = $formContent->layout; |
| 2490 | 2492 | foreach ($form_fields as $key => $value) { |
| 2491 | 2493 | // $field_name = preg_replace('/[\`\~\!\@\#\$\'\.\s\?\+\-\*\&\|\/\\!]/', '_', $value->lbl); |
| 2492 | 2494 | if (isset($entries[$key])) { |
| 2493 | - $form_fields->{$key}->val = $entries[$key]; | |
| 2495 | + $isPassword = isset($value->typ) && 'password' === $value->typ; | |
| 2496 | + // Never hand a stored password back to the browser; blank keeps it on update. | |
| 2497 | + $form_fields->{$key}->val = $isPassword ? '' : $entries[$key]; | |
| 2494 | 2498 | $form_fields->{$key}->name = $key; |
| 2499 | + if ($isPassword && '' !== (string) $entries[$key] && isset($value->valid) && is_object($value->valid)) { | |
| 2500 | + $form_fields->{$key}->valid->req = false; | |
| 2501 | + } | |
| 2495 | 2502 | } |
| 2496 | 2503 | } |
| 2497 | 2504 | $workFlowRunHelper = new WorkFlow($formID); |
| 2498 | 2505 | $workFlowreturnedOnLoad = $workFlowRunHelper->executeOnLoad( |