feat(auth): 登录注册找回绑定前台 1:1 壳层/文案/协议
抽出 sign.css,统一全页登录/注册与找回/绑定视觉;中文文案与用户协议契约对齐 Auth_Service;弹层字段与 logo 同步。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,7 @@ require_once AKSRT_DIR . '/inc/helpers/aksrt-comments.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-forum.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-slider.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-vip.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-auth-ui.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-i18n-switch.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-posts-renderer.php';
|
||||
require_once AKSRT_DIR . '/inc/helpers/aksrt-resource.php';
|
||||
|
||||
@@ -532,6 +532,16 @@ trait AKSRT_Scripts_Part_1b {
|
||||
? (string) filemtime(get_template_directory() . '/assets/css/routes/auth.css')
|
||||
: $version
|
||||
);
|
||||
|
||||
$sign_css = get_template_directory() . '/assets/css/routes/sign.css';
|
||||
if (file_exists($sign_css)) {
|
||||
wp_enqueue_style(
|
||||
'aksrt-route-sign',
|
||||
$base_uri . '/assets/css/routes/sign.css',
|
||||
['aksrt-tokens'],
|
||||
(string) filemtime($sign_css)
|
||||
);
|
||||
}
|
||||
// 手机号注册/登录 + SMS 倒计时 + 人机验证联动
|
||||
$sign_js_path = get_template_directory() . '/assets/js/sign-register.js';
|
||||
if (file_exists($sign_js_path)) {
|
||||
|
||||
@@ -208,4 +208,13 @@ trait AKSRT_Settings_Auth_Reader {
|
||||
return ['type' => $type, 'domains' => $domains];
|
||||
}
|
||||
|
||||
|
||||
/** 用户协议前台配置(enabled / required / page) */
|
||||
public static function user_agreement_settings(): array {
|
||||
return [
|
||||
'enabled' => !isset(self::get_all()['user_agreement_s']) || !empty(self::get_value('user_agreement_s', true)),
|
||||
'required' => !isset(self::get_all()['user_agreement_check']) || !empty(self::get_value('user_agreement_check', true)),
|
||||
'page' => trim((string) self::get_value('user_agreement_page', '')),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Auth frontend presentation helpers.
|
||||
*
|
||||
* @package AKSRT
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
if (!function_exists('aksrt_get_auth_agreement_view')) {
|
||||
/**
|
||||
* Build user-agreement checkbox contract for full-page and modal auth.
|
||||
*
|
||||
* @return array{enabled:bool,required:bool,label_html:string,field_name:string}
|
||||
*/
|
||||
function aksrt_get_auth_agreement_view(): array {
|
||||
$enabled = true;
|
||||
$required = true;
|
||||
$page_ref = '';
|
||||
|
||||
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'user_agreement_settings')) {
|
||||
$cfg = AKSRT_Settings::user_agreement_settings();
|
||||
$enabled = !empty($cfg['enabled']);
|
||||
$required = !empty($cfg['required']);
|
||||
$page_ref = (string) ($cfg['page'] ?? '');
|
||||
}
|
||||
|
||||
$url = '';
|
||||
if ($page_ref !== '') {
|
||||
if (ctype_digit($page_ref)) {
|
||||
$permalink = get_permalink((int) $page_ref);
|
||||
if (is_string($permalink) && $permalink !== '') {
|
||||
$url = $permalink;
|
||||
}
|
||||
} else {
|
||||
$url = esc_url_raw($page_ref);
|
||||
}
|
||||
}
|
||||
|
||||
if ($url !== '') {
|
||||
$label_html = sprintf(
|
||||
/* translators: %s: agreement page link */
|
||||
__('我已阅读并同意<a href="%s" target="_blank" rel="noopener noreferrer">用户协议</a>', 'aksrt'),
|
||||
esc_url($url)
|
||||
);
|
||||
} else {
|
||||
$label_html = esc_html__('我已阅读并同意用户协议', 'aksrt');
|
||||
}
|
||||
|
||||
return [
|
||||
'enabled' => $enabled,
|
||||
'required' => $required,
|
||||
'label_html' => $label_html,
|
||||
'field_name' => 'agree_terms',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('aksrt_get_auth_sign_logo_html')) {
|
||||
/**
|
||||
* Shared logo block for full-page sign shell.
|
||||
*/
|
||||
function aksrt_get_auth_sign_logo_html(): string {
|
||||
$logo_url = class_exists('AKSRT_Settings') ? AKSRT_Settings::user_logo_url() : '';
|
||||
$home = home_url('/');
|
||||
$name = get_bloginfo('name');
|
||||
if ($logo_url) {
|
||||
return sprintf(
|
||||
'<a href="%s"><img src="%s" alt="%s"></a>',
|
||||
esc_url($home),
|
||||
esc_url($logo_url),
|
||||
esc_attr($name)
|
||||
);
|
||||
}
|
||||
return sprintf(
|
||||
'<a href="%s" class="sign-logo__text">%s</a>',
|
||||
esc_url($home),
|
||||
esc_html(mb_substr((string) $name, 0, 2))
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user