fix(auth): align the social-login surfaces with the reference theme
The "other login methods" block drifted from zibll on three axes. Gitee was mapped to fa-code-branch because FA5 Free ships no Gitee brand glyph, so the button showed a generic branch icon; Google showed the monochrome FA glyph instead of the reference's multi-colour mark. The modal also printed an implicit agreement line under the social buttons, which the reference guest card does not have. And the top-nav user popover built its own .social-login-divider / .oauth-row / .oauth-btn markup and then wrapped that in a second separator and .social_loginbar, so the block rendered nested and unlike the reference. aksrt_brand_icon() now routes zibsvg-/customsvg- values through the shared icon renderer, and the brand map resolves gitee to zibsvg-gitee and google to zibsvg-google-color. Both sprite keys already exist in the runtime symbol sheet, which the loader pulls in on every frontend page. Because get_auth_providers_data() and binding_row() both go through aksrt_brand_icon(), one map change fixes the icon on the modal, the user card, the top-nav popover, the user-center binding list and the profile social links. render_social_buttons() is rewritten to the reference shape: an optional .social-separator, a .social_loginbar, and one .social-login-item <type> toggle-radius anchor per enabled provider with rel="nofollow" and a "<label>登录" title. oauth_button_lg switches to the button-lg variant with a label, and the WeChat entry carries qrcode-signin so auth.js opens the QR panel instead of navigating, matching the reference. The navbar and the link apply modal now append the block verbatim instead of re-wrapping it, and the user-card loop adopts the same item attributes. The retired .social-login-divider / .oauth-row / .oauth-btn rules are dropped from base-1.css, and the binding-list icon rule gains an svg selector so the sprite icons keep the 22px the FA glyphs had. Verification: node --test across widget-system, navigation, admin, asset-ledger, dev, front-submit and visual (613 tests), plus php -l on every changed PHP file. Extended the auth source contract with the agreement-line, brand-icon and popover-structure cases, and pinned the user-card guest markup.
This commit is contained in:
1 parent
6dc9265260
commit
c472045ce4
10 files changed
+127
-91
No files matched your search
+37
-18
@@ -225,29 +225,48 @@ final class OAuth {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference-parity social login block (legacy zib_social_login()).
|
||||
*
|
||||
* Emits the muted separator plus a .social_loginbar of .social-login-item
|
||||
* buttons, one per enabled provider. Returns '' when nothing is enabled.
|
||||
*
|
||||
* @param string $title Separator label; an empty title drops the separator.
|
||||
*/
|
||||
public function render_social_buttons(string $title = ''): string {
|
||||
$items = $this->get_auth_providers_data();
|
||||
if ($items === []) {
|
||||
return '';
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<div class="social-login-divider">
|
||||
<span><?php echo esc_html($title) ?: esc_html__('or', 'aksrt'); ?></span>
|
||||
</div>
|
||||
<div class="oauth-row">
|
||||
<?php foreach ($items as $item) : ?>
|
||||
<a href="<?php echo esc_url((string) $item['url']); ?>"
|
||||
class="oauth-btn oauth-btn--<?php echo esc_attr((string) $item['name']); ?>"
|
||||
data-provider="<?php echo esc_attr((string) $item['name']); ?>"
|
||||
aria-label="<?php echo esc_attr((string) $item['label']); ?>"
|
||||
title="<?php echo esc_attr((string) $item['label']); ?>">
|
||||
<?php echo $item['icon']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
return (string) ob_get_clean();
|
||||
|
||||
$large = (bool) \AKSRT\Settings\Settings::get_value('oauth_button_lg', false);
|
||||
$html = $title !== ''
|
||||
? '<p class="social-separator separator muted-3-color em09 mt10">' . esc_html($title) . '</p>'
|
||||
: '';
|
||||
$html .= '<div class="social_loginbar">';
|
||||
foreach ($items as $item) {
|
||||
$name = sanitize_html_class((string) ($item['name'] ?? ''));
|
||||
$type = str_starts_with($name, 'clogin_') ? substr($name, 7) : $name;
|
||||
$label = trim((string) ($item['label'] ?? ''));
|
||||
$url = (string) ($item['url'] ?? '');
|
||||
if ($name === '' || $type === '' || $label === '' || $url === '') {
|
||||
continue;
|
||||
}
|
||||
$class = 'social-login-item ' . $type . ($large ? ' button-lg' : ' toggle-radius');
|
||||
if ($name === 'weixingzh') {
|
||||
// Reference parity: the WeChat entry opens the QR panel instead of
|
||||
// navigating, so auth.js routes it to the modal's oauth tab.
|
||||
$class .= ' qrcode-signin';
|
||||
}
|
||||
$html .= '<a rel="nofollow" href="' . esc_url($url) . '" class="' . esc_attr($class) . '"'
|
||||
. ' data-provider="' . esc_attr($name) . '"'
|
||||
. ' aria-label="' . esc_attr(sprintf(__('%s登录', 'aksrt'), $label)) . '"'
|
||||
. ' title="' . esc_attr(sprintf(__('%s登录', 'aksrt'), $label)) . '">'
|
||||
. $item['icon'] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
. ($large ? '<span>' . esc_html(sprintf(__('%s登录', 'aksrt'), $label)) . '</span>' : '')
|
||||
. '</a>';
|
||||
}
|
||||
return $html . '</div>';
|
||||
}
|
||||
|
||||
public function get_frontend_bindings_data(int $user_id): array {
|
||||
|
||||
@@ -125,7 +125,7 @@ final class UserRenderer {
|
||||
if ($name === '' || $style_name === '' || $label === '' || $url === '') {
|
||||
continue;
|
||||
}
|
||||
$html .= '<a rel="nofollow" href="' . esc_url($url) . '" class="social-login-item ' . esc_attr($style_name) . '" data-provider="' . esc_attr($name) . '" aria-label="' . esc_attr(sprintf(__('%s登录', 'aksrt'), $label)) . '" title="' . esc_attr($label) . '">' . (string) ($item['icon'] ?? '') . '</a>';
|
||||
$html .= '<a rel="nofollow" href="' . esc_url($url) . '" class="social-login-item ' . esc_attr($style_name) . ' toggle-radius" data-provider="' . esc_attr($name) . '" aria-label="' . esc_attr(sprintf(__('%s登录', 'aksrt'), $label)) . '" title="' . esc_attr(sprintf(__('%s登录', 'aksrt'), $label)) . '">' . (string) ($item['icon'] ?? '') . '</a>';
|
||||
}
|
||||
return $html . '</div>';
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user