-
Couldn't load subscription status.
- Fork 168
Description
Is your enhancement related to a problem? Please describe.
EDIT: added form save code (copy from Core class), to complete proof of concept.
I created a quick Woocommerce 2FA account settings implementation. The form save functionality needs to be implemented still, but I wanted to drop my idea here.
With the following code the form renders well and the [verify totp], [deactivate totp], [generate codes] and [download codes] buttons function.
Next, I will seperate the user profile admin saving function from the action hook, and make sure both the front end and backend will use the same save function. In theory that should be enough to have a crude(?) initial separation of the admin settings.
As the dummy and U2F provider are shown on front end I add a filter to remove these from the front end settings.
Proposed Solution
-
Add Two_Factor_Woo class
- Endpoints
- Filter providers
- Generate form (using Core)
- Save form function (using new form_save Core)
- Enqueue Javascript
-
Adjust Two_Factor_Core class
- Add seperate form_save function
- Rewrite save user options to use new form_save
-
Add Two_Factor_Woo.js
- Two step login logic javascript for Woocommerce
Proof of Concept
-edit- see plugin repo in comment below