admin_url('admin-ajax.php'), 'admin_url' => admin_url(), 'usernameless' => (wwa_get_option('usernameless_login') === false ? "false" : wwa_get_option('usernameless_login')), 'remember_me' => (wwa_get_option('remember_me') === false ? "false" : wwa_get_option('remember_me')), 'allow_authenticator_type' => (wwa_get_option('allow_authenticator_type') === false ? "none" : wwa_get_option('allow_authenticator_type')), 'i18n_1' => __('Ready', 'wp-webauthn'), 'i18n_2' => __('Authenticate with WebAuthn', 'wp-webauthn'), 'i18n_3' => __('Hold on...', 'wp-webauthn'), 'i18n_4' => __('Please proceed...', 'wp-webauthn'), 'i18n_5' => __('Authenticating...', 'wp-webauthn'), 'i18n_6' => ''.__('Authenticated', 'wp-webauthn'), 'i18n_7' => ''.__('Auth failed', 'wp-webauthn').'', 'i18n_8' => __('No', 'wp-webauthn'), 'i18n_9' => __(' (Unavailable)', 'wp-webauthn'), 'i18n_10' => __('The site administrator has disabled usernameless login feature.', 'wp-webauthn'), 'i18n_11' => __('Error: The username field is empty.', 'wp-webauthn'), 'i18n_12' => __('Please enter the authenticator identifier', 'wp-webauthn'), 'i18n_13' => __('Please follow instructions to finish verification...', 'wp-webauthn'), 'i18n_14' => __('Verifying...', 'wp-webauthn'), 'i18n_15' => ''.__('Verification failed', 'wp-webauthn').'', 'i18n_16' => ''.__('Verification passed! You can now log in through WebAuthn', 'wp-webauthn').'', 'i18n_17' => __('Loading failed, maybe try refreshing?', 'wp-webauthn'), 'i18n_18' => __('Confirm removal of authenticator: ', 'wp-webauthn'), 'i18n_19' => __('Removing...', 'wp-webauthn'), 'i18n_20' => __('Rename', 'wp-webauthn'), 'i18n_21' => __('Rename the authenticator', 'wp-webauthn'), 'i18n_22' => __('Renaming...', 'wp-webauthn'), 'i18n_23' => __('No registered authenticators', 'wp-webauthn'), 'i18n_24' => __('Any', 'wp-webauthn'), 'i18n_25' => __('Platform authenticator', 'wp-webauthn'), 'i18n_26' => __('Roaming authenticator', 'wp-webauthn'), 'i18n_27' => __('Remove', 'wp-webauthn'), 'i18n_28' => __('Please follow instructions to finish registration...', 'wp-webauthn'), 'i18n_29' => ''._x('Registered', 'action', 'wp-webauthn').'', 'i18n_30' => ''.__('Registration failed', 'wp-webauthn').'', 'i18n_31' => __('Your browser does not support WebAuthn', 'wp-webauthn'), 'i18n_32' => __('Registrating...', 'wp-webauthn'), 'i18n_33' => ''.__('Try to enter the username', 'wp-webauthn').'', 'i18n_34' => __('After removing this authenticator, you will not be able to login with WebAuthn', 'wp-webauthn'), 'i18n_35' => __(' (Disabled)', 'wp-webauthn'), 'i18n_36' => __('The site administrator only allow platform authenticators currently.', 'wp-webauthn'), 'i18n_37' => __('The site administrator only allow roaming authenticators currently.', 'wp-webauthn') )); } // Login form function wwa_login_form_shortcode($vals){ extract(shortcode_atts( array( 'traditional' => 'true', 'username' => '', 'auto_hide' => 'true', 'to' => '' ), $vals) ); if($auto_hide === "true" && current_user_can("read")){ return ''; } // Load Javascript & CSS if(!wp_script_is('wwa_frontend_js')){ wwa_localize_frontend(); } wp_enqueue_style('wwa_frondend_css', plugins_url('css/frontend.css', __FILE__), array(), get_option('wwa_version')['version']); $html_form = '
'; $args = array('echo' => false, 'value_username' => sanitize_user($username)); $to_wwa = ''; if($to !== ""){ $args['redirect'] = sanitize_url($to); $to_wwa = ''; } if($traditional === 'true' && wwa_get_option('first_choice') !== 'webauthn'){ $html_form .= ''; } $html_form .= '
'; return $html_form; } add_shortcode('wwa_login_form', 'wwa_login_form_shortcode'); // Register form function wwa_register_form_shortcode($vals){ extract(shortcode_atts( array( 'display' => 'true' ), $vals) ); // If always display if(!current_user_can("read")){ if($display === "true"){ return '

'.__('You haven\'t logged in yet.', 'wp-webauthn').'

'; }else{ return ''; } } // Load Javascript & CSS if(!wp_script_is('wwa_frontend_js')){ wwa_localize_frontend(); } wp_enqueue_style('wwa_frondend_css', plugins_url('css/frontend.css', __FILE__), array(), get_option('wwa_version')['version']); $allowed_type = wwa_get_option('allow_authenticator_type') === false ? 'none' : wwa_get_option('allow_authenticator_type'); return '

'.__('If a type is selected, the browser will only prompt for authenticators of selected type.
Regardless of the type, you can only log in with the very same authenticators you\'ve registered.', 'wp-webauthn').'

'.__('An easily identifiable name for the authenticator. DOES NOT affect the authentication process in anyway.', 'wp-webauthn').'

'.( (wwa_get_option('usernameless_login') === "true") ? '

'.__('If registered authenticator with this feature, you can login without enter your username.
Some authenticators like U2F-only authenticators and some browsers DO NOT support this feature.
A record will be stored in the authenticator permanently untill you reset it.', 'wp-webauthn').'

' : '' ).'

     

'; } add_shortcode('wwa_register_form', 'wwa_register_form_shortcode'); // Verify button function wwa_verify_button_shortcode($vals){ extract(shortcode_atts( array( 'display' => 'true' ), $vals) ); // If always display if(!current_user_can("read")){ if($display === "true"){ return '

'.__('You haven\'t logged in yet.', 'wp-webauthn').'

'; }else{ return ''; } } // Load Javascript if(!wp_script_is('wwa_frontend_js')){ wwa_localize_frontend(); } return '

     '.(wwa_get_option('usernameless_login') === "true" ? '
     ' : '').'

'; } add_shortcode('wwa_verify_button', 'wwa_verify_button_shortcode'); // Authenticator list function wwa_list_shortcode($vals){ extract(shortcode_atts( array( 'display' => 'true' ), $vals) ); $thead = '
'; $tbody = ''; $tfoot = '
'.__('Identifier', 'wp-webauthn').''.__('Type', 'wp-webauthn').''._x('Registered', 'time', 'wp-webauthn').''.__('Last used', 'wp-webauthn').''.__('Usernameless', 'wp-webauthn').''.__('Action', 'wp-webauthn').'
'.__('Loading...', 'wp-webauthn').'
'.__('Identifier', 'wp-webauthn').''.__('Type', 'wp-webauthn').''._x('Registered', 'time', 'wp-webauthn').''.__('Last used', 'wp-webauthn').''.__('Usernameless', 'wp-webauthn').''.__('Action', 'wp-webauthn').'

'; // If always display if(!current_user_can("read")){ if($display === "true"){ // Load CSS wp_enqueue_style('wwa_frondend_css', plugins_url('css/frontend.css', __FILE__), array(), get_option('wwa_version')['version']); return $thead.''.__('You haven\'t logged in yet.', 'wp-webauthn').''.$tfoot; }else{ return ''; } } // Load Javascript & CSS if(!wp_script_is('wwa_frontend_js')){ wwa_localize_frontend(); } wp_enqueue_style('wwa_frondend_css', plugins_url('css/frontend.css', __FILE__), array(), get_option('wwa_version')['version']); return $thead.$tbody.$tfoot; } add_shortcode('wwa_list', 'wwa_list_shortcode');