@@ -1447,22 +1447,78 @@ public function updated(string $property): void
14471447 return ;
14481448 }
14491449
1450+ // Every string-typed prop that participates in the LDAP
1451+ // handshake or a downstream test surface, grouped by wizard
1452+ // step. Shared between the trim-on-assignment and the
1453+ // clearTestResult() blocks below because both need the same
1454+ // "user typed into a field the test depends on" signal.
1455+ $ connectionStringProps = [
1456+ // Step 1: Connection
1457+ 'ldap_server ' ,
1458+ 'ldap_client_tls_key ' ,
1459+ 'ldap_client_tls_cert ' ,
1460+ // Step 2: Authenticate + Scope
1461+ 'ldap_uname ' ,
1462+ 'ldap_pword ' ,
1463+ 'ldap_basedn ' ,
1464+ 'ldap_filter ' ,
1465+ 'ldap_auth_filter_query ' ,
1466+ // Step 3: Attribute Mapping
1467+ 'ldap_username_field ' ,
1468+ 'ldap_fname_field ' ,
1469+ 'ldap_lname_field ' ,
1470+ 'ldap_display_name ' ,
1471+ 'ldap_email ' ,
1472+ 'ldap_emp_num ' ,
1473+ 'ldap_phone_field ' ,
1474+ 'ldap_mobile ' ,
1475+ 'ldap_jobtitle ' ,
1476+ 'ldap_manager ' ,
1477+ 'ldap_dept ' ,
1478+ 'ldap_address ' ,
1479+ 'ldap_city ' ,
1480+ 'ldap_state ' ,
1481+ 'ldap_zip ' ,
1482+ 'ldap_country ' ,
1483+ 'ldap_location ' ,
1484+ 'ldap_active_flag ' ,
1485+ // Step 4: Sync + Defaults
1486+ 'custom_forgot_pass_url ' ,
1487+ // Not persisted; step-4 Look Up preview input
1488+ 'test_sample_username ' ,
1489+ ];
1490+
14501491 // Trim string values on assignment so pasted-with-whitespace
14511492 // inputs get normalized both in the visible field and in the
14521493 // saved config. Without this a leading space on ldap_server
14531494 // silently fails starts_with:ldap://, and a trailing newline in
14541495 // a bind username produces a mysterious LDAP-side rejection at
1455- // auth time. Textareas (TLS key/cert) tolerate the trim because
1456- // PEM parsers accept both terminating-newline and no-terminating-
1457- // newline forms.
1458- if (in_array ($ property , ['ldap_server ' , 'ad_domain ' , 'ldap_client_tls_key ' , 'ldap_client_tls_cert ' , 'ldap_uname ' , 'ldap_pword ' , 'ldap_basedn ' , 'ldap_filter ' , 'ldap_auth_filter_query ' , 'ldap_username_field ' , 'ldap_fname_field ' , 'ldap_lname_field ' , 'ldap_display_name ' , 'ldap_email ' , 'ldap_emp_num ' , 'ldap_phone_field ' , 'ldap_mobile ' , 'ldap_jobtitle ' , 'ldap_manager ' , 'ldap_dept ' , 'ldap_address ' , 'ldap_city ' , 'ldap_state ' , 'ldap_zip ' , 'ldap_country ' , 'ldap_location ' , 'ldap_active_flag ' , 'custom_forgot_pass_url ' , 'test_sample_username ' ], true ) && is_string ($ this ->{$ property })) {
1496+ // auth time. Textareas (TLS key / cert) tolerate the trim
1497+ // because PEM parsers accept both terminating-newline and
1498+ // no-terminating-newline forms. ad_domain gets trimmed too but
1499+ // does NOT invalidate the test below; it's not part of the
1500+ // ldap_bind() handshake, only post-connection scoping.
1501+ if (in_array ($ property , [...$ connectionStringProps , 'ad_domain ' ], true )) {
14591502 $ this ->{$ property } = trim ($ this ->{$ property });
14601503 }
14611504
14621505 // Any edit to a connection-shape field invalidates the prior
14631506 // network test result (a stale "connected" indicator sitting
14641507 // under a since-edited server URL would be actively misleading).
1465- if (in_array ($ property , ['ldap_server ' , 'ldap_tls ' , 'ldap_server_cert_ignore ' , 'ldap_client_tls_key ' , 'ldap_client_tls_cert ' , 'ldap_uname ' , 'ldap_pword ' , 'ldap_basedn ' , 'ldap_filter ' , 'ldap_auth_filter_query ' , 'ldap_username_field ' , 'ldap_fname_field ' , 'ldap_lname_field ' , 'ldap_display_name ' , 'ldap_email ' , 'ldap_emp_num ' , 'ldap_phone_field ' , 'ldap_mobile ' , 'ldap_jobtitle ' , 'ldap_manager ' , 'ldap_dept ' , 'ldap_address ' , 'ldap_city ' , 'ldap_state ' , 'ldap_zip ' , 'ldap_country ' , 'ldap_location ' , 'ldap_active_flag ' , 'ldap_invert_active_flag ' , 'ldap_enabled ' , 'ldap_pw_sync ' , 'ldap_default_group ' , 'custom_forgot_pass_url ' , 'test_sample_username ' ], true )) {
1508+ // Every connection-participating string prop plus the non-string
1509+ // toggles / IDs that also affect the handshake or downstream
1510+ // test surface.
1511+ $ testInvalidatingProps = [
1512+ ...$ connectionStringProps ,
1513+ 'ldap_tls ' ,
1514+ 'ldap_server_cert_ignore ' ,
1515+ 'ldap_invert_active_flag ' ,
1516+ 'ldap_enabled ' ,
1517+ 'ldap_pw_sync ' ,
1518+ 'ldap_default_group ' ,
1519+ ];
1520+
1521+ if (in_array ($ property , $ testInvalidatingProps , true )) {
14661522 $ this ->clearTestResult ();
14671523 // Also clear the step-4 preview table since it references the
14681524 // old values.
@@ -1473,11 +1529,31 @@ public function updated(string $property): void
14731529 // Clear this field's inline validation error so re-editing the
14741530 // field un-greys the Save button (which keys off canAdvance,
14751531 // which checks the error bag).
1476- if (in_array ($ property , ['ldap_server ' , 'ldap_client_tls_key ' , 'ldap_client_tls_cert ' , 'ad_domain ' , 'ldap_uname ' , 'ldap_pword ' , 'ldap_basedn ' , 'ldap_filter ' , 'ldap_auth_filter_query ' , 'ldap_username_field ' , 'ldap_fname_field ' , 'custom_forgot_pass_url ' , 'test_sample_username ' ], true )) {
1532+ if (in_array ($ property , [
1533+ 'ldap_server ' ,
1534+ 'ldap_client_tls_key ' ,
1535+ 'ldap_client_tls_cert ' ,
1536+ 'ad_domain ' ,
1537+ 'ldap_uname ' ,
1538+ 'ldap_pword ' ,
1539+ 'ldap_basedn ' ,
1540+ 'ldap_filter ' ,
1541+ 'ldap_auth_filter_query ' ,
1542+ 'ldap_username_field ' ,
1543+ 'ldap_fname_field ' ,
1544+ 'custom_forgot_pass_url ' ,
1545+ 'test_sample_username '
1546+ ], true )) {
14771547 $ this ->resetValidation ($ property );
14781548 }
14791549
1480- if (! in_array ($ property , ['currentStep ' , 'highestStepReached ' , 'dirty ' , 'testStatus ' , 'testMessage ' ], true )) {
1550+ if (!in_array ($ property , [
1551+ 'currentStep ' ,
1552+ 'highestStepReached ' ,
1553+ 'dirty ' ,
1554+ 'testStatus ' ,
1555+ 'testMessage '
1556+ ], true )) {
14811557 $ this ->dirty = true ;
14821558 }
14831559 }
0 commit comments