Merge pull request 'feat(auth): 登录注册找回绑定前台 1:1 壳层/文案/协议' (#70) from worktree-auth-frontend-1to1 into main

Reviewed-on: CYL/wordpress-theme-aksrt#70
This commit is contained in:
2026-07-12 11:17:40 +08:00
10 changed files with 511 additions and 114 deletions
+295
View File
@@ -0,0 +1,295 @@
/**
* AKSRT full-page sign shell (login / register / reset / bind).
*
* @package AKSRT
*/
.page-template-user-sign {
min-height: 500px;
}
.sign-page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
position: relative;
padding: 70px 16px 40px;
}
.sign-bg {
position: fixed;
inset: 0;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
z-index: 0;
}
.sign-topbar {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 2;
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 20px;
background: color-mix(in srgb, var(--main-bg-color, #fff) 86%, transparent);
backdrop-filter: blur(8px);
}
.sign-topbar a {
color: var(--main-color, #4e5358);
text-decoration: none;
font-size: 14px;
}
.sign-card {
position: relative;
z-index: 1;
width: 100%;
max-width: 420px;
background: var(--main-bg-color, #fff);
border-radius: var(--main-radius, 8px);
box-shadow: 0 0 10px var(--main-shadow, rgba(116, 116, 116, 0.08));
padding: 30px 35px;
}
.sign-card--left { margin-right: auto; }
.sign-card--right { margin-left: auto; }
.sign-card--center { margin: 0 auto; }
.sign-logo {
text-align: center;
margin-bottom: 20px;
}
.sign-logo img {
height: 36px;
}
.sign-logo__text {
display: inline-flex;
align-items: center;
justify-content: center;
width: 48px;
height: 48px;
border-radius: 12px;
background: var(--focus-color, #f04494);
color: #fff;
font-size: 18px;
font-weight: 700;
text-decoration: none;
}
.sign-tabs {
display: flex;
border-bottom: 2px solid var(--main-border-color, rgba(50, 50, 50, 0.06));
margin-bottom: 20px;
}
.sign-tab {
flex: 1;
padding: 10px 0;
border: none;
background: none;
font-size: 15px;
cursor: pointer;
color: var(--muted-color, #777);
border-bottom: 2px solid transparent;
margin-bottom: -2px;
transition: all .2s;
text-align: center;
font-weight: 500;
}
.sign-tab.is-active {
color: var(--focus-color, #f04494);
border-bottom-color: var(--focus-color, #f04494);
font-weight: 600;
}
.sign-tab:hover { color: var(--focus-color, #f04494); }
.sign-panel { display: none; }
.sign-panel.is-active { display: block; }
.sign-error {
background: rgba(239, 68, 68, 0.08);
border: 1px solid rgba(239, 68, 68, 0.2);
border-radius: var(--main-radius, 8px);
padding: 10px 14px;
font-size: 13px;
color: #ef4444;
margin-bottom: 16px;
}
.sign-success {
background: rgba(16, 185, 129, 0.08);
border: 1px solid rgba(16, 185, 129, 0.2);
border-radius: var(--main-radius, 8px);
padding: 10px 14px;
font-size: 13px;
color: #10b981;
margin-bottom: 16px;
}
.sign-notice {
padding: 16px;
text-align: center;
color: var(--muted-2-color, #666);
font-size: 14px;
}
.sign-form {
display: flex;
flex-direction: column;
gap: 16px;
}
.sign-form .form-field {
display: flex;
flex-direction: column;
gap: 6px;
}
.sign-form label {
font-size: 14px;
font-weight: 500;
color: var(--main-color, #4e5358);
}
.sign-form .input-wrap { position: relative; }
.sign-form .input-wrap input {
width: 100%;
height: 44px;
padding: 0 14px;
border: 1px solid transparent;
background: var(--body-bg-color, #f5f6f7);
border-radius: var(--main-radius, 8px);
font-size: 14px;
color: var(--key-color, #333);
transition: border-color .15s;
}
.sign-form .input-wrap input:focus {
outline: none;
border-color: var(--focus-color, #f04494);
box-shadow: 0 0 2px 3px var(--focus-shadow-color, rgba(253, 83, 161, 0.4));
}
.sign-form .toggle-pwd {
position: absolute;
right: 10px;
top: 50%;
transform: translateY(-50%);
background: none;
border: none;
cursor: pointer;
color: var(--muted-2-color, #999);
padding: 4px;
}
.sign-form .form-row-between {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 13px;
}
.sign-form .form-row-between a { color: var(--focus-color, #f04494); }
.sign-form .form-row-between label {
display: flex;
align-items: center;
gap: 6px;
cursor: pointer;
font-size: 13px;
color: var(--muted-color, #777);
}
.sign-form .btn-submit {
width: 100%;
height: 44px;
border: none;
border-radius: var(--main-radius, 8px);
background: var(--focus-color, #f04494);
color: #fff;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: opacity .15s;
}
.sign-form .btn-submit:hover { opacity: .85; }
.sign-form .btn-submit:disabled { opacity: .5; cursor: not-allowed; }
.sign-hint {
margin: 0;
font-size: 13px;
color: var(--muted-color, #777);
}
.sign-terms {
display: flex;
align-items: flex-start;
gap: 8px;
font-size: 13px;
cursor: pointer;
color: var(--muted-color, #777);
}
.sign-terms a {
color: var(--focus-color, #f04494);
}
.sign-footer {
text-align: center;
margin-top: 20px;
font-size: 14px;
color: var(--muted-color, #777);
}
.sign-footer a { color: var(--focus-color, #f04494); }
.sign-footer-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
text-align: center;
padding: 10px;
font-size: 12px;
color: var(--muted-2-color, #999);
z-index: 1;
background: color-mix(in srgb, var(--main-bg-color, #fff) 80%, transparent);
}
.sign-oauth {
margin-top: 20px;
}
.sign-oauth__divider {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 14px;
font-size: 12px;
color: var(--muted-2-color, #999);
}
.sign-oauth__divider::before,
.sign-oauth__divider::after {
content: "";
flex: 1;
height: 1px;
background: var(--main-border-color, rgba(50, 50, 50, 0.08));
}
@media (max-width: 480px) {
.sign-card { padding: 24px 20px; }
.sign-page { padding-top: 56px; }
}
+1 -1
View File
@@ -454,7 +454,7 @@
btn.addEventListener('click', function (e) {
var form = btn.closest('form');
if (!form) return;
var agree = form.querySelector('[name="user_agreement"]');
var agree = form.querySelector('[name="agree_terms"], [name="user_agreement"]');
if (agree && !agree.checked) {
e.preventDefault();
e.stopImmediatePropagation();
+1
View File
@@ -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', '')),
];
}
}
+81
View File
@@ -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))
);
}
}
+9 -3
View File
@@ -55,6 +55,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['log'], $_POST['pwd'])
}
}
remove_action('wp_footer', 'aksrt_render_footer_tabbar', 20);
remove_action('wp_footer', 'aksrt_render_float_buttons', 30);
add_filter('body_class', static function ($classes) {
$classes[] = 'page-template-user-sign';
return $classes;
});
get_header();
?>
@@ -65,7 +71,7 @@ get_header();
<?php if (! $oauth_data || ! is_array($oauth_data)) : ?>
<!-- 会话过期状态 -->
<div class="auth-card__expired">
<div class="auth-card__logo" aria-hidden="true">AK</div>
<div class="auth-card__logo sign-logo" aria-hidden="true"><?php if (function_exists('aksrt_get_auth_sign_logo_html')) { echo aksrt_get_auth_sign_logo_html(); } else { echo 'AK'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
<h1 class="auth-card__title"><?php bloginfo('name'); ?></h1>
<p><?php echo esc_html(__('绑定会话已过期或无效', 'aksrt')); ?></p>
<a href="<?php echo esc_url(aksrt_get_login_url()); ?>" class="btn-primary btn-lg auth-card__expired-action">
@@ -76,7 +82,7 @@ get_header();
<?php else : ?>
<!-- 正常绑定表单 -->
<div class="auth-card__logo" aria-hidden="true">AK</div>
<div class="auth-card__logo sign-logo" aria-hidden="true"><?php if (function_exists('aksrt_get_auth_sign_logo_html')) { echo aksrt_get_auth_sign_logo_html(); } else { echo 'AK'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
<h1 class="auth-card__title"><?php bloginfo('name'); ?></h1>
<p class="auth-card__subtitle">
<?php printf(esc_html__('通过 %s 登录,请绑定你的已有账号', 'aksrt'), '<strong>' . esc_html($provider_name) . '</strong>'); ?>
@@ -120,7 +126,7 @@ get_header();
</button>
</form>
<?php if (get_option('users_can_register')) :
<?php if (class_exists('AKSRT_Settings') ? AKSRT_Settings::registration_enabled() : get_option('users_can_register')) :
$register_url = aksrt_get_register_url();
$register_url = add_query_arg('obk', sanitize_text_field($_GET['obk']), $register_url);
?>
+7 -1
View File
@@ -54,13 +54,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['aksrt_action']) && $_
}
}
remove_action('wp_footer', 'aksrt_render_footer_tabbar', 20);
remove_action('wp_footer', 'aksrt_render_float_buttons', 30);
add_filter('body_class', static function ($classes) {
$classes[] = 'page-template-user-sign';
return $classes;
});
get_header();
?>
<main id="main-content" class="site-main" tabindex="-1">
<div class="auth-shell">
<div class="auth-card">
<div class="auth-card__logo" aria-hidden="true">AK</div>
<div class="auth-card__logo sign-logo" aria-hidden="true"><?php if (function_exists('aksrt_get_auth_sign_logo_html')) { echo aksrt_get_auth_sign_logo_html(); } else { echo 'AK'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
<h1 class="auth-card__title"><?php bloginfo('name'); ?></h1>
<?php if ($mode === 'success') : ?>
+50 -71
View File
@@ -1,4 +1,4 @@
<?php
<?php
/**
* Template Name: AKSRT - 登录/注册
* Template Post Type: page
@@ -20,25 +20,25 @@ $tab_source = $requested_tab !== '' ? $requested_tab : $route_tab;
$tab = $tab_aliases[$tab_source] ?? 'signin';
$redirect_to = !empty($_GET['redirect_to']) ? esc_url_raw(wp_unslash((string) $_GET['redirect_to'])) : home_url();
$registration_open = class_exists('AKSRT_Settings') && AKSRT_Settings::registration_enabled();
if (class_exists('AKSRT_Settings') && method_exists('AKSRT_Settings', 'close_signup') && AKSRT_Settings::close_signup()) {
$registration_open = false;
}
$titles = [
'signin' => __('用户登录', 'aksrt'),
'signup' => __('用户注册', 'aksrt'),
'signup' => __('新用户注册', 'aksrt'),
];
$page_title = ($titles[$tab] ?? __('登录 / 注册', 'aksrt')) . ' - ' . get_bloginfo('name');
$interim = isset($_REQUEST['interim-login']);
// 搂4.1 Defense-in-depth: redirect out when close_sign is active (backup of auth router gate)
if (class_exists('AKSRT_Settings') && AKSRT_Settings::close_sign() && !is_user_logged_in() && !$interim) {
wp_safe_redirect(home_url('/'), 302);
exit;
}
// §4.1 close_signin: password login disabled — force signin tab to show social-only message
$close_signin = class_exists('AKSRT_Settings') ? AKSRT_Settings::close_signin() : false;
if ($close_signin && $tab === 'signin') {
// Don't allow password form submission
$_SERVER['REQUEST_METHOD'] = 'GET';
}
@@ -63,7 +63,7 @@ $background_html = '';
$sign_ui = class_exists('AKSRT_Settings') ? AKSRT_Settings::sign_page_ui() : [];
$card_position = $sign_ui['card_position'] ?? 'center';
$sign_show_logo = $sign_ui['show_logo'] ?? true;
$sign_show_header = $sign_ui['show_header'] ?? true;
$sign_show_header = !empty($sign_ui['show_header']);
$sign_theme_mode = $sign_ui['theme_mode'] ?? 'default';
if (class_exists('AKSRT_Settings')) {
$bg_ids = $sign_ui['background'] ?? [];
@@ -73,7 +73,6 @@ if (class_exists('AKSRT_Settings')) {
$background_html = '<div class="sign-bg" style="background-image:url(' . esc_url($bg_url) . ');"></div>';
}
} elseif (is_string($bg_ids) && $bg_ids !== '') {
// BC: comma-separated string from old storage
$ids = array_filter(array_map('absint', explode(',', $bg_ids)));
if (!empty($ids)) {
$bg_url = wp_get_attachment_url($ids[array_rand($ids)]);
@@ -106,13 +105,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['user_login'], $_POST[
if (!empty($result['verification_required'])) {
$register_success = sprintf(
'%s <a href="%s">%s</a>',
esc_html($result['message'] ?? __('Registration successful. Please complete email verification.', 'aksrt')),
esc_html($result['message'] ?? __('注册成功,请完成邮箱验证。', 'aksrt')),
esc_url($result['verify_url'] ?? ''),
esc_html__('前往验证', 'aksrt')
);
} else {
$register_success = sprintf(
__('Registration successful. Please continue on the <a href="%s">login page</a>.', 'aksrt'),
__('注册成功,请前往<a href="%s">登录页</a>继续。', 'aksrt'),
esc_url(aksrt_get_login_url())
);
}
@@ -128,6 +127,15 @@ if (!empty($_GET['invite'])) {
} elseif (!empty($_COOKIE['aksrt_invite'])) {
$invite_prefill = sanitize_key(wp_unslash($_COOKIE['aksrt_invite']));
}
$agreement = function_exists('aksrt_get_auth_agreement_view')
? aksrt_get_auth_agreement_view()
: ['enabled' => true, 'required' => true, 'label_html' => esc_html__('我已阅读并同意用户协议', 'aksrt'), 'field_name' => 'agree_terms'];
$sign_css_uri = get_template_directory_uri() . '/assets/css/routes/sign.css';
$sign_css_ver = file_exists(get_template_directory() . '/assets/css/routes/sign.css')
? (string) filemtime(get_template_directory() . '/assets/css/routes/sign.css')
: AKSRT_VERSION;
?>
<!DOCTYPE html>
<html lang="<?php echo esc_attr(str_replace('_', '-', get_bloginfo('language'))); ?>">
@@ -137,81 +145,45 @@ if (!empty($_GET['invite'])) {
<meta name="robots" content="noindex, nofollow">
<title><?php echo esc_html($page_title); ?></title>
<?php wp_head(); ?>
<style>
.sign-page{min-height:100vh;display:flex;align-items:center;justify-content:center;position:relative;padding:70px 16px 40px}
.sign-bg{position:fixed;inset:0;background-repeat:no-repeat;background-size:cover;background-position:center;z-index:0}
.sign-card{position:relative;z-index:1;width:100%;max-width:420px;background:var(--main-bg-color,#fff);border-radius:var(--main-radius,8px);box-shadow:0 0 10px var(--main-shadow,rgba(116,116,116,0.08));padding:30px 35px}
.sign-card--left{margin-right:auto}
.sign-card--right{margin-left:auto}
.sign-card--center{margin:0 auto}
.sign-logo{text-align:center;margin-bottom:20px}
.sign-logo img{height:36px}
.sign-logo__text{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:12px;background:var(--focus-color,#f04494);color:#fff;font-size:18px;font-weight:700;text-decoration:none}
.sign-tabs{display:flex;border-bottom:2px solid var(--main-border-color,rgba(50,50,50,0.06));margin-bottom:20px}
.sign-tab{flex:1;padding:10px 0;border:none;background:none;font-size:15px;cursor:pointer;color:var(--muted-color,#777);border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s;text-align:center;font-weight:500}
.sign-tab.is-active{color:var(--focus-color,#f04494);border-bottom-color:var(--focus-color,#f04494);font-weight:600}
.sign-tab:hover{color:var(--focus-color,#f04494)}
.sign-panel{display:none}
.sign-panel.is-active{display:block}
.sign-error{background:rgba(239,68,68,0.08);border:1px solid rgba(239,68,68,0.2);border-radius:var(--main-radius,8px);padding:10px 14px;font-size:13px;color:#ef4444;margin-bottom:16px}
.sign-success{background:rgba(16,185,129,0.08);border:1px solid rgba(16,185,129,0.2);border-radius:var(--main-radius,8px);padding:10px 14px;font-size:13px;color:#10b981;margin-bottom:16px}
.sign-form{display:flex;flex-direction:column;gap:16px}
.sign-form .form-field{display:flex;flex-direction:column;gap:6px}
.sign-form label{font-size:14px;font-weight:500;color:var(--main-color,#4e5358)}
.sign-form .input-wrap{position:relative}
.sign-form .input-wrap input{width:100%;height:44px;padding:0 14px;border:1px solid transparent;background:var(--body-bg-color,#f5f6f7);border-radius:var(--main-radius,8px);font-size:14px;color:var(--key-color,#333);transition:border-color .15s}
.sign-form .input-wrap input:focus{outline:none;border-color:var(--focus-color,#f04494);box-shadow:0 0 2px 3px var(--focus-shadow-color,rgba(253,83,161,0.4))}
.sign-form .toggle-pwd{position:absolute;right:10px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:var(--muted-2-color,#999);padding:4px}
.sign-form .form-row-between{display:flex;align-items:center;justify-content:space-between;font-size:13px}
.sign-form .form-row-between a{color:var(--focus-color,#f04494)}
.sign-form .form-row-between label{display:flex;align-items:center;gap:6px;cursor:pointer;font-size:13px;color:var(--muted-color,#777)}
.sign-form .btn-submit{width:100%;height:44px;border:none;border-radius:var(--main-radius,8px);background:var(--focus-color,#f04494);color:#fff;font-size:15px;font-weight:600;cursor:pointer;transition:opacity .15s}
.sign-form .btn-submit:hover{opacity:.85}
.sign-form .btn-submit:disabled{opacity:.5;cursor:not-allowed}
.sign-hint{margin:0;font-size:13px;color:var(--muted-color,#777)}
.sign-terms{display:flex;align-items:flex-start;gap:8px;font-size:13px;cursor:pointer;color:var(--muted-color,#777)}
.sign-footer{text-align:center;margin-top:20px;font-size:14px;color:var(--muted-color,#777)}
.sign-footer a{color:var(--focus-color,#f04494)}
.sign-footer-bar{position:fixed;bottom:0;left:0;right:0;text-align:center;padding:10px;font-size:12px;color:var(--muted-2-color,#999);z-index:1}
@media(max-width:480px){.sign-card{padding:24px 20px}}
</style>
<link rel="stylesheet" href="<?php echo esc_url($sign_css_uri); ?>?ver=<?php echo esc_attr($sign_css_ver); ?>">
</head>
<body <?php body_class('page-template-user-sign' . ($sign_theme_mode !== 'default' ? ' sign-theme-' . esc_attr($sign_theme_mode) : '')); ?>>
<?php echo $background_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ($sign_show_header && !$interim) : ?>
<div class="sign-topbar">
<a href="<?php echo esc_url(home_url('/')); ?>"><?php echo esc_html(get_bloginfo('name')); ?></a>
<a href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('返回首页', 'aksrt'); ?></a>
</div>
<?php endif; ?>
<main class="sign-page">
<div class="sign-card sign-card--<?php echo esc_attr($card_position); ?>">
<?php if ($sign_show_logo) : ?>
<div class="sign-logo">
<?php $logo_url = class_exists('AKSRT_Settings') ? AKSRT_Settings::user_logo_url() : ''; ?>
<?php if ($logo_url) : ?>
<a href="<?php echo esc_url(home_url('/')); ?>"><img src="<?php echo esc_url($logo_url); ?>" alt="<?php echo esc_attr(get_bloginfo('name')); ?>"></a>
<?php else : ?>
<a href="<?php echo esc_url(home_url('/')); ?>" class="sign-logo__text"><?php echo esc_html(mb_substr(get_bloginfo('name'), 0, 2)); ?></a>
<?php endif; ?>
<?php echo function_exists('aksrt_get_auth_sign_logo_html') ? aksrt_get_auth_sign_logo_html() : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php endif; ?>
<?php if ($sign_show_header) : ?>
<div class="sign-tabs">
<button type="button" class="sign-tab<?php echo $tab === 'signin' ? ' is-active' : ''; ?>" data-sign-tab="signin"><?php esc_html_e('登录', 'aksrt'); ?></button>
<?php if ($registration_open) : ?>
<button type="button" class="sign-tab<?php echo $tab === 'signup' ? ' is-active' : ''; ?>" data-sign-tab="signup"><?php esc_html_e('注册', 'aksrt'); ?></button>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="sign-panel<?php echo $tab === 'signin' ? ' is-active' : ''; ?>" data-sign-panel="signin">
<?php if ($login_error) : ?><div class="sign-error"><?php echo esc_html($login_error); ?></div><?php endif; ?>
<?php if ($close_signin) : ?>
<div class="sign-notice" style="padding:16px;text-align:center;color:var(--muted-2-color,#666);">
<?php esc_html_e('This site currently supports third-party account sign-in only. Please use one of the social login buttons below.', 'aksrt'); ?>
<div class="sign-notice">
<?php esc_html_e('当前站点仅支持第三方账号登录,请使用下方社交登录方式。', 'aksrt'); ?>
</div>
<?php else : ?>
<form class="sign-form" id="sign-login-form" method="post" action="">
<?php wp_nonce_field('aksrt_login', '_login_nonce'); ?>
<div class="form-field">
<label for="sign-user-login"><?php esc_html_e('Email / Username', 'aksrt'); ?></label>
<div class="input-wrap"><input type="text" name="log" id="sign-user-login" autocomplete="username" required placeholder="<?php esc_attr_e('Please enter your email or username', 'aksrt'); ?>"></div>
<label for="sign-user-login"><?php esc_html_e('邮箱 / 用户名', 'aksrt'); ?></label>
<div class="input-wrap"><input type="text" name="log" id="sign-user-login" autocomplete="username" required placeholder="<?php esc_attr_e('请输入邮箱或用户名', 'aksrt'); ?>"></div>
</div>
<div class="form-field">
<label for="sign-user-pass"><?php esc_html_e('密码', 'aksrt'); ?></label>
@@ -221,20 +193,25 @@ if (!empty($_GET['invite'])) {
</div>
</div>
<div class="form-row-between">
<label><input type="checkbox" name="rememberme" value="forever"> <?php esc_html_e('Remember me', 'aksrt'); ?></label>
<a href="<?php echo esc_url(aksrt_get_reset_password_url()); ?>"><?php esc_html_e('Forgot password?', 'aksrt'); ?></a>
<label><input type="checkbox" name="rememberme" value="forever"> <?php esc_html_e('记住我', 'aksrt'); ?></label>
<a href="<?php echo esc_url(aksrt_get_reset_password_url()); ?>"><?php esc_html_e('忘记密码?', 'aksrt'); ?></a>
</div>
<?php if (function_exists('aksrt_render_captcha')) aksrt_render_captcha('login'); ?>
<input type="hidden" name="redirect_to" value="<?php echo esc_url($redirect_to); ?>">
<button type="submit" class="btn-submit"><?php esc_html_e('登录', 'aksrt'); ?></button>
</form>
<?php endif; // close_signin gate ?>
<?php endif; ?>
<?php if (class_exists('AKSRT_OAuth')) : ?>
<?php $social = AKSRT_OAuth::get_instance()->render_social_buttons(); ?>
<?php if ($social) echo '<div style="margin-top:20px;">' . $social . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ($social) : ?>
<div class="sign-oauth">
<div class="sign-oauth__divider"><span><?php esc_html_e('其他登录方式', 'aksrt'); ?></span></div>
<?php echo $social; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($registration_open) : ?>
<div class="sign-footer"><?php esc_html_e('Don\'t have an account yet?', 'aksrt'); ?> <a href="#" data-sign-switch="signup"><?php esc_html_e('Register now', 'aksrt'); ?></a></div>
<div class="sign-footer"><?php esc_html_e('还没有账号?', 'aksrt'); ?> <a href="#" data-sign-switch="signup"><?php esc_html_e('立即注册', 'aksrt'); ?></a></div>
<?php endif; ?>
</div>
@@ -245,12 +222,12 @@ if (!empty($_GET['invite'])) {
<form class="sign-form" id="sign-register-form" method="post" action="" novalidate>
<?php wp_nonce_field('aksrt_register', '_register_nonce'); ?>
<div class="form-field">
<label for="sign-reg-login"><?php esc_html_e('Username', 'aksrt'); ?></label>
<label for="sign-reg-login"><?php esc_html_e('用户名', 'aksrt'); ?></label>
<div class="input-wrap"><input type="text" name="user_login" id="sign-reg-login" autocomplete="username" required placeholder="<?php esc_attr_e('请输入用户名', 'aksrt'); ?>"></div>
</div>
<div class="form-field">
<label for="sign-reg-email"><?php esc_html_e('Email Address', 'aksrt'); ?></label>
<div class="input-wrap"><input type="email" name="user_email" id="sign-reg-email" autocomplete="email" required placeholder="<?php esc_attr_e('Please enter your email', 'aksrt'); ?>"></div>
<label for="sign-reg-email"><?php esc_html_e('邮箱', 'aksrt'); ?></label>
<div class="input-wrap"><input type="email" name="user_email" id="sign-reg-email" autocomplete="email" required placeholder="<?php esc_attr_e('请输入邮箱', 'aksrt'); ?>"></div>
</div>
<div class="form-field">
<label for="sign-reg-pass"><?php esc_html_e('登录密码', 'aksrt'); ?></label>
@@ -282,17 +259,19 @@ if (!empty($_GET['invite'])) {
<?php endif; ?>
</div>
<?php } ?>
<?php if (!empty($agreement['enabled'])) : ?>
<label class="sign-terms">
<input type="checkbox" name="agree_terms" value="1" required>
<span><?php esc_html_e('I agree to the Terms of Service', 'aksrt'); ?></span>
<input type="checkbox" name="<?php echo esc_attr($agreement['field_name']); ?>" value="1" <?php echo !empty($agreement['required']) ? 'required' : ''; ?>>
<span><?php echo $agreement['label_html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
</label>
<?php endif; ?>
<?php if (class_exists('AKSRT_Settings') && AKSRT_Settings::registration_requires_email_verification()) : ?>
<p class="sign-hint"><?php esc_html_e('Email verification is required after registration.', 'aksrt'); ?></p>
<p class="sign-hint"><?php esc_html_e('注册后需要完成邮箱验证。', 'aksrt'); ?></p>
<?php endif; ?>
<?php if (function_exists('aksrt_render_captcha')) aksrt_render_captcha('register'); ?>
<button type="submit" class="btn-submit"><?php esc_html_e('注册', 'aksrt'); ?></button>
</form>
<div class="sign-footer"><?php esc_html_e('Already have an account?', 'aksrt'); ?> <a href="#" data-sign-switch="signin"><?php esc_html_e('Sign in now', 'aksrt'); ?></a></div>
<div class="sign-footer"><?php esc_html_e('已有账号?', 'aksrt'); ?> <a href="#" data-sign-switch="signin"><?php esc_html_e('立即登录', 'aksrt'); ?></a></div>
</div>
<?php endif; ?>
</div>
+48 -38
View File
@@ -51,32 +51,40 @@ foreach ($oauth_providers as $provider) {
$site_name = get_bloginfo('name');
$reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_password_url() : wp_lostpassword_url();
$agreement = function_exists('aksrt_get_auth_agreement_view')
? aksrt_get_auth_agreement_view()
: ['enabled' => true, 'required' => true, 'label_html' => esc_html__('我已阅读并同意用户协议', 'aksrt'), 'field_name' => 'agree_terms'];
$logo_url = class_exists('AKSRT_Settings') ? AKSRT_Settings::user_logo_url() : '';
?>
<div class="aksrt-modal-auth" id="aksrt-modal-auth" aria-hidden="true" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e('Sign In', 'aksrt'); ?>">
<div class="aksrt-modal-auth" id="aksrt-modal-auth" aria-hidden="true" role="dialog" aria-modal="true" aria-label="<?php esc_attr_e('登录', 'aksrt'); ?>">
<div class="aksrt-modal-auth__overlay"></div>
<div class="aksrt-modal-auth__card">
<button type="button" class="aksrt-modal-auth__close" aria-label="<?php esc_attr_e('Close', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__close" aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>">
<i class="fas fa-times"></i>
</button>
<div class="aksrt-modal-auth__header">
<div class="aksrt-modal-auth__logo">AK</div>
<?php if ($logo_url) : ?>
<div class="aksrt-modal-auth__logo aksrt-modal-auth__logo--image"><img src="<?php echo esc_url($logo_url); ?>" alt=""></div>
<?php else : ?>
<div class="aksrt-modal-auth__logo"><?php echo esc_html(mb_substr($site_name, 0, 2)); ?></div>
<?php endif; ?>
<h2 class="aksrt-modal-auth__title"><?php echo esc_html($site_name); ?></h2>
</div>
<div class="aksrt-modal-auth__tabs" role="tablist">
<button type="button" class="aksrt-modal-auth__tab is-active" data-tab="login" role="tab" aria-selected="true">
<?php esc_html_e('Sign In', 'aksrt'); ?>
<?php esc_html_e('登录', 'aksrt'); ?>
</button>
<?php if ($registration_open) : ?>
<button type="button" class="aksrt-modal-auth__tab" data-tab="register" role="tab" aria-selected="false">
<?php esc_html_e('Register', 'aksrt'); ?>
<?php esc_html_e('注册', 'aksrt'); ?>
</button>
<?php endif; ?>
<?php if ($show_qrcode_tab) : ?>
<button type="button" class="aksrt-modal-auth__tab" data-tab="qrcode" role="tab" aria-selected="false">
<?php esc_html_e('QR Login', 'aksrt'); ?>
<?php esc_html_e('扫码登录', 'aksrt'); ?>
</button>
<?php endif; ?>
</div>
@@ -84,7 +92,7 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<div class="aksrt-modal-auth__panel is-active" data-panel="login">
<?php if ($close_signin) : ?>
<div class="aksrt-modal-auth__error is-success" id="aksrt-modal-login-error">
<?php esc_html_e('Password sign-in is currently disabled. Please use one of the social login methods below.', 'aksrt'); ?>
<?php esc_html_e('当前已关闭账密登录,请使用下方第三方登录方式。', 'aksrt'); ?>
</div>
<?php else : ?>
<form class="aksrt-modal-auth__form" id="aksrt-modal-login-form">
@@ -92,15 +100,15 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<?php wp_nonce_field('aksrt_login', '_login_nonce'); ?>
<div class="aksrt-modal-auth__field">
<label for="modal-login-user"><?php esc_html_e('Email / Username', 'aksrt'); ?></label>
<input type="text" id="modal-login-user" name="log" autocomplete="username" required placeholder="<?php esc_attr_e('Please enter your email or username', 'aksrt'); ?>">
<label for="modal-login-user"><?php esc_html_e('邮箱 / 用户名', 'aksrt'); ?></label>
<input type="text" id="modal-login-user" name="log" autocomplete="username" required placeholder="<?php esc_attr_e('请输入邮箱或用户名', 'aksrt'); ?>">
</div>
<div class="aksrt-modal-auth__field">
<label for="modal-login-pass"><?php esc_html_e('Password', 'aksrt'); ?></label>
<label for="modal-login-pass"><?php esc_html_e('密码', 'aksrt'); ?></label>
<div class="aksrt-modal-auth__pass-wrap">
<input type="password" id="modal-login-pass" name="pwd" autocomplete="current-password" required placeholder="<?php esc_attr_e('Please enter your password', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__pass-toggle" aria-label="<?php esc_attr_e('Toggle password visibility', 'aksrt'); ?>">
<input type="password" id="modal-login-pass" name="pwd" autocomplete="current-password" required placeholder="<?php esc_attr_e('请输入密码', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__pass-toggle" aria-label="<?php esc_attr_e('显示或隐藏密码', 'aksrt'); ?>">
<i class="far fa-eye"></i>
</button>
</div>
@@ -111,11 +119,11 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<?php endif; ?>
<div class="aksrt-modal-auth__actions">
<a href="<?php echo esc_url($reset_url); ?>" class="aksrt-modal-auth__link"><?php esc_html_e('Forgot password?', 'aksrt'); ?></a>
<a href="<?php echo esc_url($reset_url); ?>" class="aksrt-modal-auth__link"><?php esc_html_e('忘记密码?', 'aksrt'); ?></a>
</div>
<button type="submit" class="aksrt-modal-auth__submit">
<span><?php esc_html_e('Sign In', 'aksrt'); ?></span>
<span><?php esc_html_e('登录', 'aksrt'); ?></span>
<i class="fas fa-spinner fa-spin" hidden></i>
</button>
</form>
@@ -129,30 +137,30 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<?php wp_nonce_field('aksrt_register', '_register_nonce'); ?>
<div class="aksrt-modal-auth__field">
<label for="modal-reg-user"><?php esc_html_e('Username', 'aksrt'); ?></label>
<input type="text" id="modal-reg-user" name="user_login" autocomplete="username" required placeholder="<?php esc_attr_e('Please enter a username', 'aksrt'); ?>">
<label for="modal-reg-user"><?php esc_html_e('用户名', 'aksrt'); ?></label>
<input type="text" id="modal-reg-user" name="user_login" autocomplete="username" required placeholder="<?php esc_attr_e('请输入用户名', 'aksrt'); ?>">
</div>
<div class="aksrt-modal-auth__field">
<label for="modal-reg-email"><?php esc_html_e('Email', 'aksrt'); ?></label>
<input type="email" id="modal-reg-email" name="user_email" autocomplete="email" required placeholder="<?php esc_attr_e('Please enter your email', 'aksrt'); ?>">
<label for="modal-reg-email"><?php esc_html_e('邮箱', 'aksrt'); ?></label>
<input type="email" id="modal-reg-email" name="user_email" autocomplete="email" required placeholder="<?php esc_attr_e('请输入邮箱', 'aksrt'); ?>">
</div>
<div class="aksrt-modal-auth__field">
<label for="modal-reg-pass"><?php esc_html_e('Password', 'aksrt'); ?></label>
<label for="modal-reg-pass"><?php esc_html_e('密码', 'aksrt'); ?></label>
<div class="aksrt-modal-auth__pass-wrap">
<input type="password" id="modal-reg-pass" name="user_pass" autocomplete="new-password" required minlength="6" placeholder="<?php esc_attr_e('At least 6 characters', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__pass-toggle" aria-label="<?php esc_attr_e('Toggle password visibility', 'aksrt'); ?>">
<input type="password" id="modal-reg-pass" name="user_pass" autocomplete="new-password" required minlength="6" placeholder="<?php esc_attr_e('至少 6 位字符', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__pass-toggle" aria-label="<?php esc_attr_e('显示或隐藏密码', 'aksrt'); ?>">
<i class="far fa-eye"></i>
</button>
</div>
</div>
<div class="aksrt-modal-auth__field">
<label for="modal-reg-pass-confirm"><?php esc_html_e('Confirm Password', 'aksrt'); ?></label>
<label for="modal-reg-pass-confirm"><?php esc_html_e('确认密码', 'aksrt'); ?></label>
<div class="aksrt-modal-auth__pass-wrap">
<input type="password" id="modal-reg-pass-confirm" name="user_pass_confirm" autocomplete="new-password" required minlength="6" placeholder="<?php esc_attr_e('Re-enter your password', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__pass-toggle" aria-label="<?php esc_attr_e('Toggle password visibility', 'aksrt'); ?>">
<input type="password" id="modal-reg-pass-confirm" name="user_pass_confirm" autocomplete="new-password" required minlength="6" placeholder="<?php esc_attr_e('请再次输入密码', 'aksrt'); ?>">
<button type="button" class="aksrt-modal-auth__pass-toggle" aria-label="<?php esc_attr_e('显示或隐藏密码', 'aksrt'); ?>">
<i class="far fa-eye"></i>
</button>
</div>
@@ -173,13 +181,15 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
</div>
<?php endif; ?>
<?php if (!empty($agreement['enabled'])) : ?>
<label class="aksrt-modal-auth__checkbox aksrt-modal-auth__agreement">
<input type="checkbox" name="agree_terms" value="1" required>
<span><?php esc_html_e('I agree to the Terms of Service', 'aksrt'); ?></span>
<input type="checkbox" name="<?php echo esc_attr($agreement['field_name']); ?>" value="1" <?php echo !empty($agreement['required']) ? 'required' : ''; ?>>
<span><?php echo $agreement['label_html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></span>
</label>
<?php endif; ?>
<?php if ($email_verification) : ?>
<p class="aksrt-modal-auth__hint"><?php esc_html_e('Email verification is required after registration.', 'aksrt'); ?></p>
<p class="aksrt-modal-auth__hint"><?php esc_html_e('注册后需要完成邮箱验证。', 'aksrt'); ?></p>
<?php endif; ?>
<?php if (function_exists('aksrt_render_captcha')) : ?>
@@ -187,7 +197,7 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<?php endif; ?>
<button type="submit" class="aksrt-modal-auth__submit">
<span><?php esc_html_e('Register', 'aksrt'); ?></span>
<span><?php esc_html_e('注册', 'aksrt'); ?></span>
<i class="fas fa-spinner fa-spin" hidden></i>
</button>
</form>
@@ -199,14 +209,14 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<div class="aksrt-modal-auth__form">
<div class="aksrt-modal-auth__error" id="aksrt-modal-qrcode-error" hidden></div>
<div class="aksrt-modal-auth__qr-code"></div>
<p class="aksrt-modal-auth__hint"><?php esc_html_e('Use WeChat to scan the QR code and complete sign-in on your phone.', 'aksrt'); ?></p>
<p class="aksrt-modal-auth__hint"><?php esc_html_e('请使用微信扫码,在手机上完成登录。', 'aksrt'); ?></p>
</div>
</div>
<?php endif; ?>
<?php if (!empty($oauth_providers)) : ?>
<div class="aksrt-modal-auth__divider">
<span><?php esc_html_e('Or continue with', 'aksrt'); ?></span>
<span><?php esc_html_e('其他登录方式', 'aksrt'); ?></span>
</div>
<div class="aksrt-modal-auth__oauth">
@@ -231,23 +241,23 @@ $reset_url = function_exists('aksrt_get_reset_password_url') ? aksrt_get_reset_p
<div class="aksrt-modal-auth__footer">
<span class="aksrt-modal-auth__footer-text" data-for="login">
<?php if ($registration_open) : ?>
<?php esc_html_e('No account yet?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="register"><?php esc_html_e('Register now', 'aksrt'); ?></button>
<?php esc_html_e('还没有账号?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="register"><?php esc_html_e('立即注册', 'aksrt'); ?></button>
<?php elseif ($show_qrcode_tab) : ?>
<?php esc_html_e('Prefer QR sign-in?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="qrcode"><?php esc_html_e('Open QR Login', 'aksrt'); ?></button>
<?php esc_html_e('使用扫码登录?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="qrcode"><?php esc_html_e('打开扫码登录', 'aksrt'); ?></button>
<?php endif; ?>
</span>
<?php if ($registration_open) : ?>
<span class="aksrt-modal-auth__footer-text" data-for="register" hidden>
<?php esc_html_e('Already have an account?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="login"><?php esc_html_e('Sign in now', 'aksrt'); ?></button>
<?php esc_html_e('已有账号?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="login"><?php esc_html_e('立即登录', 'aksrt'); ?></button>
</span>
<?php endif; ?>
<?php if ($show_qrcode_tab) : ?>
<span class="aksrt-modal-auth__footer-text" data-for="qrcode" hidden>
<?php esc_html_e('Want to use your password instead?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="login"><?php esc_html_e('Back to Sign In', 'aksrt'); ?></button>
<?php esc_html_e('改用密码登录?', 'aksrt'); ?>
<button type="button" class="aksrt-modal-auth__switch" data-switch="login"><?php esc_html_e('返回登录', 'aksrt'); ?></button>
</span>
<?php endif; ?>
</div>