Files
wordpress-theme-aksrt/inc/helpers/user-center-renderers/profile-account-modals.php
T
kate522 7a4419d0dd fix(captcha): 1:1 align bind-phone and real status contracts
Add bind_phone captcha scene across schema/runtime/UI, require captcha on
phone bind, return real captcha status objects instead of legacy option
aliases, and harden form discovery for page-sign auth forms.
2026-07-13 21:14:31 +08:00

128 lines
7.5 KiB
PHP

<?php
/** Internal account modal renderer. @package AKSRT */
defined('ABSPATH') || exit;
$context = is_array($args['context'] ?? null) ? $args['context'] : [];
extract($context, EXTR_SKIP); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
?>
<!-- ==================== 修改密码弹窗 ==================== -->
<div id="pwd-modal" class="aksrt-modal" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( '修改密码', 'aksrt' ); ?>">
<div class="aksrt-modal__overlay" data-close-modal></div>
<div class="aksrt-modal__box">
<div class="aksrt-modal__header">
<div class="aksrt-modal__title-wrap">
<span class="aksrt-modal__icon"><i class="fas fa-lock" aria-hidden="true"></i></span>
<h4><?php esc_html_e( '修改密码', 'aksrt' ); ?></h4>
</div>
<button type="button" class="aksrt-modal__close" data-close-modal title="<?php esc_attr_e( '关闭', 'aksrt' ); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
</div>
<form id="pwd-form" autocomplete="off" novalidate>
<div class="modal-field">
<label for="pwd-old"><?php esc_html_e( '原密码', 'aksrt' ); ?></label>
<input type="password" id="pwd-old" name="old_password" required minlength="1">
<button type="button" class="toggle-pwd" data-target="pwd-old"></button>
</div>
<div class="modal-field">
<label for="pwd-new"><?php esc_html_e( '新密码', 'aksrt' ); ?></label>
<input type="password" id="pwd-new" name="new_password" required minlength="6" placeholder="<?php esc_attr_e( '至少6位字符', 'aksrt' ); ?>">
<button type="button" class="toggle-pwd" data-target="pwd-new"></button>
<div class="pwd-strength" id="pwd-strength-bar">
<div class="pwd-strength__fill"></div>
</div>
<span class="pwd-strength__text" id="pwd-strength-text"></span>
</div>
<div class="modal-field">
<label for="pwd-new-confirm"><?php esc_html_e( '确认新密码', 'aksrt' ); ?></label>
<input type="password" id="pwd-new-confirm" name="new_password_confirm" required minlength="6" placeholder="<?php esc_attr_e( '再次输入新密码', 'aksrt' ); ?>">
<button type="button" class="toggle-pwd" data-target="pwd-new-confirm"></button>
</div>
<div class="modal-field modal-field--code">
<label for="pwd-code"><?php esc_html_e( '当前邮箱验证码', 'aksrt' ); ?></label>
<div class="code-input-group">
<input type="text" id="pwd-code" name="email_code" maxlength="6" inputmode="numeric" pattern="[0-9]*" placeholder="6位数字验证码" required>
<button type="button" class="btn-ghost btn-sm code-send-btn" id="pwd-send-code"><?php esc_html_e( '发送到当前邮箱', 'aksrt' ); ?></button>
</div>
</div>
<?php aksrt_render_captcha('change_password'); ?>
<div class="aksrt-modal__footer">
<button type="button" class="btn-ghost btn-sm" data-close-modal><?php esc_html_e( '取消', 'aksrt' ); ?></button>
<button type="submit" class="btn-primary btn-sm" id="pwd-submit"><?php esc_html_e( '确认修改', 'aksrt' ); ?></button>
</div>
</form>
</div>
</div>
<!-- ==================== 更改邮箱弹窗 ==================== -->
<div id="email-modal" class="aksrt-modal" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e( '更改邮箱', 'aksrt' ); ?>">
<div class="aksrt-modal__overlay" data-close-modal></div>
<div class="aksrt-modal__box">
<div class="aksrt-modal__header">
<div class="aksrt-modal__title-wrap">
<span class="aksrt-modal__icon"><i class="far fa-envelope" aria-hidden="true"></i></span>
<h4><?php esc_html_e( '更改邮箱', 'aksrt' ); ?></h4>
</div>
<button type="button" class="aksrt-modal__close" data-close-modal title="<?php esc_attr_e( '关闭', 'aksrt' ); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
</div>
<form id="email-form" autocomplete="off" novalidate>
<div class="modal-field">
<label><?php esc_html_e( '当前邮箱', 'aksrt' ); ?></label>
<div class="readonly-display"><?php echo esc_html( $user_email ); ?></div>
</div>
<div class="modal-field">
<label for="email-current-password"><?php esc_html_e( '当前密码', 'aksrt' ); ?></label>
<input type="password" id="email-current-password" name="current_password" required minlength="1" placeholder="<?php esc_attr_e( '请输入当前登录密码', 'aksrt' ); ?>">
<button type="button" class="toggle-pwd" data-target="email-current-password"></button>
</div>
<div class="modal-field">
<label for="email-new"><?php esc_html_e( '新邮箱', 'aksrt' ); ?></label>
<input type="email" id="email-new" name="new_email" required placeholder="<?php esc_attr_e( '请输入新的邮箱地址', 'aksrt' ); ?>">
</div>
<div class="modal-field modal-field--code">
<label for="email-code"><?php esc_html_e( '新邮箱验证码', 'aksrt' ); ?></label>
<div class="code-input-group">
<input type="text" id="email-code" name="email_code" maxlength="6" inputmode="numeric" pattern="[0-9]*" placeholder="6位数字验证码" required>
<button type="button" class="btn-ghost btn-sm code-send-btn" id="email-send-code"><?php esc_html_e( '发送到新邮箱', 'aksrt' ); ?></button>
</div>
<p class="settings-hint settings-hint--bottom"><?php esc_html_e( '验证码将发送到你填写的新邮箱,验证通过后才会正式切换。', 'aksrt' ); ?></p>
</div>
<?php aksrt_render_captcha('change_email'); ?>
<div class="aksrt-modal__footer">
<button type="button" class="btn-ghost btn-sm" data-close-modal><?php esc_html_e( '取消', 'aksrt' ); ?></button>
<button type="submit" class="btn-primary btn-sm" id="email-submit"><?php esc_html_e( '确认更改', 'aksrt' ); ?></button>
</div>
</form>
</div>
</div>
<div id="phone-modal" class="aksrt-modal" hidden>
<div class="aksrt-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="phone-modal-title">
<div class="aksrt-modal__header">
<h3 id="phone-modal-title"><?php esc_html_e('绑定手机', 'aksrt'); ?></h3>
<button type="button" class="aksrt-modal__close" data-modal-close="phone-modal" aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>">&times;</button>
</div>
<form id="aksrt-bind-phone-form" class="aksrt-modal__body" data-aksrt-bind-phone-form>
<div class="form-field">
<label for="bind-phone-input"><?php esc_html_e('手机号', 'aksrt'); ?></label>
<input type="tel" id="bind-phone-input" name="phone" data-aksrt-phone-input maxlength="11" autocomplete="tel" required placeholder="<?php esc_attr_e('请输入手机号', 'aksrt'); ?>">
</div>
<div class="form-field form-field--code">
<label for="bind-phone-code"><?php esc_html_e('短信验证码', 'aksrt'); ?></label>
<div class="input-wrap input-wrap--code">
<input type="text" id="bind-phone-code" name="code" maxlength="8" autocomplete="one-time-code" required placeholder="<?php esc_attr_e('请输入验证码', 'aksrt'); ?>">
<button type="button" class="btn-secondary btn-sm" data-aksrt-sms-trigger data-aksrt-sms-scene="bind_phone" data-aksrt-sms-phone="#bind-phone-input"><?php esc_html_e('获取验证码', 'aksrt'); ?></button>
</div>
</div>
<?php if (function_exists('aksrt_render_captcha')) : ?>
<?php aksrt_render_captcha('bind_phone'); ?>
<?php endif; ?>
<div class="aksrt-modal__actions">
<button type="submit" class="btn-primary"><?php esc_html_e('确认绑定', 'aksrt'); ?></button>
</div>
</form>
</div>
</div>