[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/com_users/js/ -> two-factor-focus-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * @copyright   (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
   6     * @license     GNU General Public License version 2 or later; see LICENSE.txt
   7     */
   8    (function () {
   9      document.addEventListener('DOMContentLoaded', function () {
  10        var elCodeField = document.getElementById('users-mfa-code');
  11        var elValidateButton = document.getElementById('users-mfa-captive-button-submit');
  12        var elToolbarButton = document.getElementById('toolbar-user-mfa-submit').querySelector('button'); // Focus the code field. If the code field is hidden, focus the submit button (useful e.g. for WebAuthn)
  13  
  14        if (elCodeField && elCodeField.style.display !== 'none' && !elCodeField.classList.contains('visually-hidden') && elCodeField.type !== 'hidden') {
  15          elCodeField.focus();
  16        } else {
  17          if (elValidateButton) {
  18            elValidateButton.focus();
  19          }
  20  
  21          if (elToolbarButton) {
  22            elToolbarButton.focus();
  23          }
  24        } // Capture the admin toolbar buttons, make them click the inline buttons
  25  
  26  
  27        document.querySelectorAll('.button-user-mfa-submit').forEach(function (elButton) {
  28          elButton.addEventListener('click', function (e) {
  29            e.preventDefault();
  30            elValidateButton.click();
  31          });
  32        });
  33        document.querySelectorAll('.button-user-mfa-logout').forEach(function (elButton) {
  34          elButton.addEventListener('click', function (e) {
  35            e.preventDefault();
  36            var elLogout = document.getElementById('users-mfa-captive-button-logout');
  37  
  38            if (elLogout) {
  39              elLogout.click();
  40            }
  41          });
  42        });
  43        document.querySelectorAll('.button-user-mfa-choose-another').forEach(function (elButton) {
  44          elButton.addEventListener('click', function (e) {
  45            e.preventDefault();
  46            var elChooseAnother = document.getElementById('users-mfa-captive-form-choose-another');
  47  
  48            if (elChooseAnother) {
  49              elChooseAnother.click();
  50            }
  51          });
  52        });
  53      });
  54    })();
  55  
  56  })();


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer