Files
kate522 41366e7fc4 feat(auth): rebuild the sign-in surfaces on the shared sign-card contract
The login/register page and the auth modal had drifted into a parallel
system: floating-input fields, a sign-page-card shell and a bespoke
jio-auth-modal wrapper that none of the theme's own sign CSS targeted.
The reference card rules (.sign, .sign-img, .sign-content, .line-form-input,
.scale-placeholder, .social_loginbar, .title-h-left, #u_sign .modal-dialog,
.qrcode-signin-container) have been in main.css all along, so the fix is to
render the reference DOM instead of re-styling a second one.

auth-content.php now emits one .sign.jio-panel.blur-bg.relative card with a
.tab-content of #tab-sign-in / #tab-sign-up / #tab-resetpassword /
#tab-qrcode-signin / #tab-bind panes. Each pane opens with a
.title-h-left.fa-2x heading plus a .muted-color.px12 link, fields are
.relative.line-form.mb10 > .line-form-input + .scale-placeholder +
.line-form-line, the verification trigger is the .yztx.abs-right captchsubmit
button, and submits are .but.radius.jb-blue|jb-green.padding-lg.btn-block.
Social entries come from the shared render_social_buttons() separator +
.social_loginbar, and the OAuth bind pane uses the oauth-data-box avatar card.

The modal shell is #u_sign.modal > .modal-dialog > .sign-content >
.sign-img.absolute.hide-sm + .sign, and the page shell is the reference
.container.sign-page > .row.sign-row.gutters-5 > .col-md-6(.col-md-offset-6/
.col-md-offset-3).sign-col with a .fixed.lazyload background and a blurred
fixed footer. auth.js drives .in instead of .is-open, toggles the new
password/signin-mode/invite-gate controls and no longer touches the retired
markup. The page also drops two footer-hook removals that targeted functions
which no longer exist, and opts out of the fixed-nav offset.

The sign page's custom theme setting now actually applies: Router answers
jio_forced_theme_mode, jioData.themeForced wins over the stored cookie in
theme.js, theme-toggle positions are suppressed, and the page marks html/body
dark or white accordingly.

sign.css shrinks from ~114 lines of bespoke component styling to a thin
positioning layer, and the retired classes are gone rather than kept.

Verification: php -l on every changed PHP file, node --check on both JS files,
node --test across widget-system, navigation and front-submit (873 passing),
and tools/audit-psr4-paths.php / audit-admin-contracts.php both at 0 errors.
assets/js/runtime/main.min.js was rebuilt because theme.js gained the forced
theme branch.
2026-11-04 16:04:24 +08:00

112 lines
4.4 KiB
PHP

<?php
/**
* Template Name: Jio - 登录注册
* Template Post Type: page
*
* @package Jio
*/
defined('ABSPATH') || exit;
$allowed_tabs = ['signin', 'signup', 'resetpassword', 'bind', 'oauth'];
$tab = isset($_GET['tab']) ? sanitize_key(wp_unslash((string) $_GET['tab'])) : 'signin';
$tab = in_array($tab, $allowed_tabs, true) ? $tab : 'signin';
$wechat = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::get_weixingzh_settings() : [];
if (!isset($_GET['tab']) && !empty($wechat['priority']) && class_exists('\Jio\Auth\WeixinGzh') && \Jio\Auth\WeixinGzh::is_enabled()) {
$tab = 'oauth';
}
$interim = isset($_REQUEST['interim-login']);
$redirect_to = !empty($_GET['redirect_to']) ? esc_url_raw(wp_unslash((string) $_GET['redirect_to'])) : home_url('/');
$obk = !empty($_GET['obk']) ? sanitize_text_field(wp_unslash((string) $_GET['obk'])) : '';
if (is_user_logged_in() && $tab !== 'bind' && $tab !== 'oauth') {
wp_safe_redirect($redirect_to);
exit;
}
if (class_exists('\Jio\Settings\Settings') && \Jio\Settings\Settings::close_sign() && !$interim) {
wp_safe_redirect(home_url('/'));
exit;
}
if ($tab === 'signup' && class_exists('\Jio\Settings\Settings') && !\Jio\Settings\Settings::registration_enabled()) {
$tab = 'signin';
}
$ui = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::sign_page_ui() : [];
$images = $ui['background'] ?? [];
$background_id = $images ? (int) $images[array_rand($images)] : 0;
$background_url = $background_id > 0 ? (string) wp_get_attachment_image_url($background_id, 'full') : '';
// 主题模式由 Router 通过 jio_initial_theme_mode / jio_theme_mode_js_value 统一注入。
$theme_mode = (string) ($ui['theme_mode'] ?? 'no');
$position = (string) ($ui['card_position'] ?? 'right');
$show_header = !empty($ui['show_header']) && !$interim;
add_filter('document_title_parts', static function (array $parts): array {
$parts['title'] = __('登录 / 注册', 'jio');
unset($parts['tagline']);
return $parts;
});
$initial_theme_mode = '';
if ($theme_mode !== 'no' && class_exists('\Jio\Settings\Settings')) {
$initial_theme_mode = (string) apply_filters('jio_forced_theme_mode', '');
}
remove_action('wp_footer', 'jio_float_right');
$body_classes = ['page-template-user-sign', 'site-layout-1'];
if ($theme_mode !== 'no') {
$body_classes[] = $theme_mode;
}
if ($initial_theme_mode === 'dark') {
$body_classes[] = 'theme-dark';
$body_classes[] = 'dark-theme';
} elseif ($initial_theme_mode === 'light') {
$body_classes[] = 'white-theme';
}
$card_offset = ' col-md-offset-6';
if ($position === 'left') {
$card_offset = '';
} elseif ($position === 'center') {
$card_offset = ' col-md-offset-3';
}
$jio_auth_context = [
'surface' => 'page',
'tab' => $tab,
'show_logo' => !empty($ui['show_logo']),
'redirect_to' => $redirect_to,
'obk' => $obk,
];
?>
<!doctype html>
<html <?php language_attributes(); ?><?php echo $initial_theme_mode === 'dark' ? ' class="dark"' : ''; ?><?php echo $initial_theme_mode !== '' ? ' data-theme="' . esc_attr($initial_theme_mode) . '"' : ''; ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
<meta name="robots" content="noindex, nofollow">
<?php wp_head(); ?>
</head>
<body <?php body_class($body_classes); ?><?php echo $initial_theme_mode !== '' ? ' data-theme="' . esc_attr($initial_theme_mode) . '"' : ''; ?>>
<?php wp_body_open(); ?>
<?php if ($background_url !== '') : ?>
<div class="fixed lazyload" data-bg="<?php echo esc_url($background_url); ?>" style="background-repeat:no-repeat;background-size:cover;background-position:center;"></div>
<?php endif; ?>
<?php if ($show_header && function_exists('jio_header')) { jio_header(); } ?>
<main role="main" class="container sign-page">
<div class="row sign-row gutters-5">
<div class="col-md-6<?php echo esc_attr($card_offset); ?> sign-col">
<div style="padding:20px 0 60px 0">
<?php require get_template_directory() . '/templates/parts/auth-content.php'; ?>
</div>
</div>
</div>
</main>
<?php if (!$interim) : ?>
<div class="sign-page-footer text-center blur-bg fixed px12 opacity8">
<?php echo !empty($ui['footer']) ? wp_kses_post((string) $ui['footer']) : '&copy; ' . esc_html(wp_date('Y')) . ' ' . esc_html(get_bloginfo('name')); ?>
</div>
<?php endif; ?>
<?php wp_footer(); ?>
</body>
</html>