1/** 2 * @file 3 * Theme elements for user password forms. 4 */ 5 6((Drupal) => { 7 /** 8 * Constructs a password confirm message element. 9 * 10 * @param {object} passwordSettings 11 * An object containing password related settings and translated text to 12 * display. 13 * @param {string} passwordSettings.confirmTitle 14 * The translated confirm description that labels the actual confirm text. 15 * 16 * @return {string} 17 * Markup for the password confirm message. 18 */ 19 Drupal.theme.passwordConfirmMessage = ({ confirmTitle }) => { 20 const confirmTextWrapper = 21 '<span data-drupal-selector="password-match-status-text"></span>'; 22 return `<div aria-live="polite" aria-atomic="true" class="password-confirm-message" data-drupal-selector="password-confirm-message">${confirmTitle} ${confirmTextWrapper}</div>`; 23 }; 24 25 /** 26 * Constructs a password strength message. 27 * 28 * @param {object} passwordSettings 29 * An object containing password related settings and translated text to 30 * display. 31 * @param {string} passwordSettings.strengthTitle 32 * The title that precedes the strength text. 33 * 34 * @return {string} 35 * Markup for password strength message. 36 */ 37 Drupal.theme.passwordStrength = ({ strengthTitle }) => { 38 const strengthIndicator = 39 '<div class="password-strength__indicator" data-drupal-selector="password-strength-indicator"></div>'; 40 const strengthText = 41 '<span class="password-strength__text" data-drupal-selector="password-strength-text"></span>'; 42 return ` 43 <div class="password-strength"> 44 <div class="password-strength__meter" data-drupal-selector="password-strength-meter">${strengthIndicator}</div> 45 <div aria-live="polite" aria-atomic="true" class="password-strength__title">${strengthTitle} ${strengthText}</div> 46 </div> 47 `; 48 }; 49 50 /** 51 * Constructs password suggestions tips. 52 * 53 * @param {object} passwordSettings 54 * An object containing password related settings and translated text to 55 * display. 56 * @param {string} passwordSettings.hasWeaknesses 57 * The title that precedes tips. 58 * @param {Array.<string>} tips 59 * Array containing the tips. 60 * 61 * @return {string} 62 * Markup for password suggestions. 63 */ 64 Drupal.theme.passwordSuggestions = ({ hasWeaknesses }, tips) => 65 `<div class="password-suggestions">${ 66 tips.length 67 ? `${hasWeaknesses}<ul><li>${tips.join('</li><li>')}</li></ul>` 68 : '' 69 }</div>`; 70})(Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.