Skip to content

Commit 8ea2810

Browse files
dknaussclaude
andcommitted
chore: add Playground demo blueprint for PR #922
Seeded demo: 3 failed verification attempts 5 minutes ago, shows the updated failure notice in context (no rate-limit error). Landing page: /wp-login.php?action=two_factor_notice_demo Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 975c808 commit 8ea2810

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

playground/blueprint.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
3+
"preferredVersions": { "php": "8.2", "wp": "latest" },
4+
"landingPage": "/wp-login.php?action=two_factor_notice_demo",
5+
"steps": [
6+
{
7+
"step": "installPlugin",
8+
"pluginData": {
9+
"resource": "url",
10+
"url": "https://wordpress-playground-cors-proxy.net/?https://github.com/dknauss/two-factor/archive/refs/heads/ux/notice-mixed-audience.zip"
11+
},
12+
"options": { "activate": true, "targetFolderName": "two-factor" }
13+
},
14+
{
15+
"step": "writeFile",
16+
"path": "/wordpress/wp-content/mu-plugins/two-factor-demo.php",
17+
"data": "<?php\nadd_action( 'login_form_two_factor_notice_demo', function () {\n\tif ( ! class_exists( 'Two_Factor_Core' ) || ! class_exists( 'Two_Factor_Email' ) ) {\n\t\twp_die( 'Two-Factor plugin not active.' );\n\t}\n\t$user = get_user_by( 'login', 'tf-demo' );\n\tif ( ! $user ) {\n\t\t$user_id = wp_create_user( 'tf-demo', wp_generate_password(), 'tf-demo@example.com' );\n\t\t$user = get_user_by( 'id', $user_id );\n\t}\n\tupdate_user_meta( $user->ID, '_two_factor_provider', 'Two_Factor_Email' );\n\tupdate_user_meta( $user->ID, '_two_factor_enabled_providers', array( 'Two_Factor_Email' ) );\n\tupdate_user_meta( $user->ID, Two_Factor_Core::USER_FAILED_LOGIN_ATTEMPTS_KEY, 3 );\n\tupdate_user_meta( $user->ID, Two_Factor_Core::USER_RATE_LIMIT_KEY, time() - 300 );\n\t$login_nonce = Two_Factor_Core::create_login_nonce( $user->ID );\n\tif ( ! $login_nonce ) { wp_die( 'Could not create login nonce.' ); }\n\tTwo_Factor_Core::login_html( $user, $login_nonce['key'], admin_url() );\n\texit;\n} );"
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)