Making WordPress.org


Ignore:
Timestamp:
02/26/2018 12:45:25 PM (7 years ago)
Author:
tellyworth
Message:

2FA: move inline css to external file.

Also improve client-side input validation.

See #77

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-two-factor/providers/class-wporg-two-factor-secondary.php

    r6759 r6763  
    4444        <p>
    4545            <label for="authcode"><?php esc_html_e( 'Verification Code:', 'wporg' ); ?></label>
    46             <input type="tel" name="two-factor-backup-code" id="authcode" class="input" value="" size="20" pattern="[0-9]*" />
     46            <input type="tel" name="two-factor-backup-code" id="authcode" class="input" value="" size="20" pattern="[0-9]{6,20}" title="<?php esc_attr_e( 'Codes are at least 6 decimal digits' ); ?>" />
    4747            <?php submit_button( __( 'Authenticate', 'wporg' ) ); ?>
    4848        </p>
     
    8080
    8181        // Add some CSS for this clss.
    82         add_action( 'login_head', [ $this, 'add_styles' ] );
     82        wp_enqueue_style( 'two-factor-login', plugins_url( '/css/login.css', dirname( __FILE__ ) ) );
    8383
    8484        foreach ( $providers as $class => $path ) {
     
    9595
    9696        return parent::__construct();
    97     }
    98 
    99     // Add some specific styles for this class.
    100     public function add_styles() {
    101         if ( isset( $_GET['provider'] ) && $_GET['provider'] === __CLASS__ ) {
    102             echo '<style>
    103                 body.login-action-backup_2fa .backup-methods-wrap {
    104                     display: none;
    105                 }
    106                 body.login-action-backup_2fa input[name="two-factor-backup-resend"] {
    107 
    108                 }
    109             </style>';
    110         }
    11197    }
    11298
Note: See TracChangeset for help on using the changeset viewer.