101 lines
5.4 KiB
Diff
101 lines
5.4 KiB
Diff
|
|
Subject: [PATCH] setup wizard: ask for a wallet, not a mailbox
|
||
|
|
|
||
|
|
The installer is the one place in WordPress where the fork cannot do its
|
||
|
|
work from a plugin. It runs before plugins load, and it refuses to finish
|
||
|
|
without an email address, so a site with no mail identity cannot be
|
||
|
|
installed at all.
|
||
|
|
|
||
|
|
The change is the smallest one that removes the requirement:
|
||
|
|
|
||
|
|
- "Your Email" becomes "Your wallet address", and it is optional. The
|
||
|
|
installer has nothing to verify a signature against yet — the site
|
||
|
|
does not exist — so an address typed here is taken on trust and can be
|
||
|
|
replaced from the profile screen afterwards, where it CAN be proved.
|
||
|
|
- The two is_email() gates become one address check.
|
||
|
|
- wp_install() still receives an email string, because its signature and
|
||
|
|
everything downstream of it expects one. It gets a permanently
|
||
|
|
unroutable .invalid placeholder.
|
||
|
|
|
||
|
|
The two helper functions are defined by the Sirius Press bootstrap
|
||
|
|
must-use plugin, which loads before this file on every request including
|
||
|
|
the installer. If that plugin is missing, they fall back to accepting
|
||
|
|
nothing and the installer behaves as it does on stock WordPress minus the
|
||
|
|
email field.
|
||
|
|
|
||
|
|
Applies to: WordPress 7.1.1
|
||
|
|
--- a/wp-admin/install.php
|
||
|
|
+++ b/wp-admin/install.php
|
||
|
|
@@ -101,6 +101,8 @@
|
||
|
|
$weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
|
||
|
|
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
|
||
|
|
$admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
|
||
|
|
+ // Sirius Press: the identity field on this form is a wallet address.
|
||
|
|
+ $admin_wallet = isset( $_POST['admin_wallet'] ) ? trim( wp_unslash( $_POST['admin_wallet'] ) ) : '';
|
||
|
|
|
||
|
|
if ( ! is_null( $error ) ) {
|
||
|
|
?>
|
||
|
|
@@ -175,9 +177,9 @@
|
||
|
|
</tr>
|
||
|
|
<?php endif; ?>
|
||
|
|
<tr>
|
||
|
|
- <th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th>
|
||
|
|
- <td><input name="admin_email" type="email" id="admin_email" size="25" aria-describedby="admin-email-desc" value="<?php echo esc_attr( $admin_email ); ?>" />
|
||
|
|
- <p id="admin-email-desc"><?php _e( 'Double-check your email address before continuing.' ); ?></p></td>
|
||
|
|
+ <th scope="row"><label for="admin_wallet"><?php _e( 'Your wallet address' ); ?></label></th>
|
||
|
|
+ <td><input name="admin_wallet" type="text" id="admin_wallet" size="25" class="code" aria-describedby="admin-wallet-desc" value="<?php echo esc_attr( $admin_wallet ); ?>" autocapitalize="off" autocomplete="off" spellcheck="false" />
|
||
|
|
+ <p id="admin-wallet-desc"><?php _e( 'Sirius Press: your Bitcoin Cash address is your account. Leave this blank to attach one later from your profile — until then the password above is the only way in.' ); ?></p></td>
|
||
|
|
</tr>
|
||
|
|
<?php $blog_privacy_selector_title = has_action( 'blog_privacy_selector' ) ? __( 'Site visibility' ) : __( 'Search engine visibility' ); ?>
|
||
|
|
<tr>
|
||
|
|
@@ -411,10 +413,20 @@
|
||
|
|
$user_name = isset( $_POST['user_name'] ) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
|
||
|
|
$admin_password = isset( $_POST['admin_password'] ) ? wp_unslash( $_POST['admin_password'] ) : '';
|
||
|
|
$admin_password_check = isset( $_POST['admin_password2'] ) ? wp_unslash( $_POST['admin_password2'] ) : '';
|
||
|
|
- $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : '';
|
||
|
|
+ $admin_wallet = isset( $_POST['admin_wallet'] ) ? trim( wp_unslash( $_POST['admin_wallet'] ) ) : '';
|
||
|
|
$public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 1;
|
||
|
|
|
||
|
|
- // Check email address.
|
||
|
|
+ /*
|
||
|
|
+ * Sirius Press: there is no email step. The account identity is a
|
||
|
|
+ * CashAddress, and it is optional here because the installer has nothing
|
||
|
|
+ * to verify a signature against yet — the site does not exist. An address
|
||
|
|
+ * typed now is attached below; an administrator who leaves it blank
|
||
|
|
+ * attaches one from their profile afterwards, where they can prove it.
|
||
|
|
+ */
|
||
|
|
+ $admin_wallet = sirius_press_install_address( $admin_wallet );
|
||
|
|
+ $admin_email = sirius_press_install_stub_email( $admin_wallet );
|
||
|
|
+
|
||
|
|
+ // Check the username and password.
|
||
|
|
$error = false;
|
||
|
|
if ( empty( $user_name ) ) {
|
||
|
|
// TODO: Poka-yoke.
|
||
|
|
@@ -427,19 +439,20 @@
|
||
|
|
// TODO: Poka-yoke.
|
||
|
|
display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
|
||
|
|
$error = true;
|
||
|
|
- } elseif ( empty( $admin_email ) ) {
|
||
|
|
- // TODO: Poka-yoke.
|
||
|
|
- display_setup_form( __( 'You must provide an email address.' ) );
|
||
|
|
- $error = true;
|
||
|
|
- } elseif ( ! is_email( $admin_email ) ) {
|
||
|
|
- // TODO: Poka-yoke.
|
||
|
|
- display_setup_form( __( 'Sorry, that is not a valid email address. Email addresses look like <code>username@example.com</code>.' ) );
|
||
|
|
+ } elseif ( false === $admin_wallet ) {
|
||
|
|
+ display_setup_form( __( 'Sorry, that is not a valid Bitcoin Cash address. Leave the field blank if you would rather attach a wallet after installing.' ) );
|
||
|
|
$error = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
if ( false === $error ) {
|
||
|
|
$wpdb->show_errors();
|
||
|
|
$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language );
|
||
|
|
+
|
||
|
|
+ // Sirius Press: record the administrator's wallet so they can sign in
|
||
|
|
+ // with it immediately.
|
||
|
|
+ if ( '' !== $admin_wallet && ! empty( $result['user_id'] ) ) {
|
||
|
|
+ update_user_meta( (int) $result['user_id'], 'sirius_wallet_address', $admin_wallet );
|
||
|
|
+ }
|
||
|
|
?>
|
||
|
|
|
||
|
|
<h1><?php _e( 'Success!' ); ?></h1>
|