Field Definitions: This is the area where you define the fields ----------------------------------------------------------------------------------- Captcha Access Section ----------------------------------------------------------------------------------- Requestor Identify Section Hidden field and rule for normalizing the phone number ----------------------------------------------------------------------------------- DoD Organizational Affiliation Section Us DOD Activity Code DoD Contractor Additional Fields Rules to Hide and Show addition fields ---------------------------------------------------------------------------------- Sponsoring Activity Section ------------------------------------------------------------------------------------ Multi Factor Authentication type -------------------------------------------------------------------------------------- CAC Fields -------------------------------------------------------------------------------------- Cybersecurity Training Certificate Section ------------------------------------------------------------------------------------ IP Catcher -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Below is where the Fields are shown on the page.
|
<script> function formatPhoneNumber(phoneNumberString) { var match = phoneNumberString.match( /^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$/, ); if (match) { return `${match[1] ? '+' + match[1] + ' ' : ''}(${match[2]}) ${match[3]}-${match[4]}`; } return ''; } function setPhoneNumberValue(formName, formId) { AJS.$(formName) .find('#i_PhoneNumberFormatted') .val(formatPhoneNumber(AJS.$(formName).find('#i_PhoneNumber').val())); } AJS.$('#rw_search_container').hide(); </script> |
<script> const getCacURL = 'https://clientcert.secure.mafdmo.com/client-cert-api'; async function fetchCacInfo() { let done = false; let fetchResult = { cacInfo: undefined, retryCount: 0 }; console.log('Starting fetch operation some more...'); while (!done && fetchResult.retryCount < 10) { console.log(`Fetching CAC info: ${fetchResult.retryCount}`); const response = await fetch(getCacURL, { credentials: 'include', mode: 'cors', }).catch((reason) => { console.error('fetch() promise failed:'); console.error(reason); return undefined; }); if (response) { await response .json() .then((value) => { fetchResult = { ...fetchResult, cacInfo: value }; const cacInfoStr = JSON.stringify(value, null, 2); console.log('cacInfo:'); console.log(cacInfoStr); done = true; }) .catch((reason) => { console.error('response.json() promise failed:'); console.error(reason); }); } fetchResult.retryCount++; } if (!done) { console.log(`Fetch not done after ${fetchResult.retryCount} retries`); } console.log(JSON.stringify(fetchResult, null, 2)); return fetchResult; } async function getCacInfo(formName, formId) { if (!formName) return; let fetchResult; cfSetValueWithEventPropagation(formId, 'cacFetchStatus', 'Fetching user information from CAC...'); try { fetchResult = await fetchCacInfo(); } catch (e) { cfSetValueWithEventPropagation(formId, 'cacFetchStatus', 'Failure accessing CAC certificate.'); console.error('Error: '); console.error(JSON.stringify(e, null, 2)); return; } console.log('fetchResult:'); console.log(JSON.stringify(fetchResult, null, 2)); if (fetchResult.cacInfo !== undefined) { cfSetValueWithEventPropagation(formId, 'cacSubject', fetchResult.cacInfo.subject); cfSetValueWithEventPropagation(formId, 'cacJSON', JSON.stringify(fetchResult.cacInfo, null, 2)); cfSetValueWithEventPropagation( formId, 'cacFetchStatus', 'CAC user info successfully retrieved.', ); } else { cfSetValueWithEventPropagation( formId, 'cacFetchStatus', `Failure retrieving CAC information after ${fetchResult.retryCount} tries`, ); } } </script> |