code: function populateActionCodes() {
    var emailForSignIn = null;
    var signInTime = 0;
    if ('localStorage' in window && window['localStorage'] !== null) {
      try {
        // Try to parse as JSON first using new storage format.
        var emailForSignInData =
            JSON.parse(window.localStorage.getItem('emailForSignIn'));
        emailForSignIn = emailForSignInData['email'] || null;
        signInTime = emailForSignInData['timestamp'] || 0;
      } catch (e) {
        // JSON parsing failed. This means the email is stored in the old string
        // format.
        emailForSignIn = window.localStorage.getItem('emailForSignIn');
      }
      if (emailForSignIn) {
        // Clear old codes. Old format codes should be cleared immediately.
        if (new Date().getTime() - signInTime >= 1 * 24 * 3600 * 1000) {
          // Remove email from storage.
          window.localStorage.removeItem('emailForSignIn');
        }
      }
    }
    var actionCode = getParameterByName('oobCode');
    if (actionCode != null) {
      var mode = getParameterByName('mode');
      if (mode == 'verifyEmail') {
        $('#email-verification-code').val(actionCode);
      } else if (mode == 'resetPassword') {
        $('#password-reset-code').val(actionCode);
      } else if (mode == 'signIn') {
        if (emailForSignIn) {
          $('#sign-in-with-email-link-email').val(emailForSignIn);
          $('#sign-in-with-email-link-link').val(window.location.href);
          onSignInWithEmailLink();
          // Remove email from storage as the code is only usable once.
          window.localStorage.removeItem('emailForSignIn');
        }
      } else {
        $('#email-verification-code').val(actionCode);
        $('#password-reset-code').val(actionCode);
      }
    }
  }
docs: Detects if an action code is passed in the URL, and populates accordingly
  the input field for the confirm email verification process.