-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the Two Factor settings portable to other settings screens #335
Comments
My main concern here would be portability of styles -- it may not render correctly. What other plugins create user screens on the front-end, and do they have any consistent hook usage that can be used to add extra fields? Or would it be better if we provided a function that they could use to render our stuff? Or sort out a common action? |
Ideal situation would be to have a shortcode which would display two-factor settings. I recently attempted to include two-factor settings into WooCommerce's Here are modifications I've done: Edited
Then, to make sure after showing two-factor settings page doesn't die rendering, also added following to In function
To:
Though in frontend settings does not display e-mail address, nor QR code, so I believe there is something still missing... I am also unsure if
Anyone care to join into solving this? |
Hi there, There is any update about this? |
WooCommerce redirect customers to frontend So if we want to use two-factor with WooCommerce, we need frontent shortcodes. |
When I integrated the 1. Save routines do not return useful informationSee #244. 2FA core uses the two-factor/class-two-factor-core.php Line 1028 in 736473e
Unfortunately, this method doesn't return what type of info is being saved. So to determine if a new 2FA method or primary provider was saved, you currently have to duplicate this logic. Likewise, the TOTP 2FA routine saves error notices into user meta:
So you have to manually retrieve the notices to display them yourself. 2. Reliance on admin functions
3, User settings URL needs to be filteredThe two-factor/class-two-factor-core.php Lines 202 to 215 in 736473e
This won't work for the frontend, especially with TOTP saving. Workaround is to use the 4. U2F
|
// See: http://stackoverflow.com/questions/833032/submit-is-not-a-function-error-in-javascript | |
$( '<form>' )[0].submit.call( $( '#your-profile' )[0] ); |
To workaround this, I had to register my own fido-u2f-admin
script just to replace this submit form call.
5. 2FA <table>
uses a nested table
The user_two_factor_options()
method uses a nested table for display:
two-factor/class-two-factor-core.php
Lines 965 to 971 in 736473e
<table class="form-table" id="two-factor-options"> | |
<tr> | |
<th> | |
<?php esc_html_e( 'Two-Factor Options', 'two-factor' ); ?> | |
</th> | |
<td> | |
<table class="two-factor-methods-table"> |
This is problematic for use on the frontend since themes can style tables in a myriad of ways.
You can workaround this with CSS, but it's annoying to have to resort to CSS hacks to remove the first table from being displayed.
Other than that, calling on the options table, enqueued JS hooks and validation methods should work. You just have to write some code to workaround these issues. I'll post my code for my BuddyPress 2FA plugin later once I've cleaned things up. Update - BP Two Factor is available here: https://github.com/r-a-y/bp-two-factor
Also see #261 where some of this is being worked on.
Why not add an option in the plugin configuration to add custom style to the 2fa field? |
Hi there what's the status with compatibility with Woocommerce ? Possible ? PS - I would be happy to pay for this plugin. Maybe make a "pro" version and sell it @ $15 similar to the one on codecanyon (I would rather support this plugin). However, it looks like it's just not yet there for my needs. I will keep an eye on dev. |
#504 laid some groundwork for this |
Currently the two-factor setup for each user is tied to the standard user profile page. This makes it impossible to configure the two-factor authentication for sites that don't allow users to access the standard profile page.
The text was updated successfully, but these errors were encountered: