fix: 认证失败后允许重新提交
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,13 +17,14 @@ $info = class_exists(AuthApply::class) ? AuthApply::get_auth_info($user_id) : []
|
||||
$apply = class_exists(AuthApply::class) ? AuthApply::get_apply_payload($user_id) : [];
|
||||
$record = is_array($apply['_application'] ?? null) ? $apply['_application'] : [];
|
||||
$stage = sanitize_key((string) ($record['status'] ?? ''));
|
||||
$locks_application = in_array($stage, ['created', 'provider_pending', 'provider_processing', 'manual_pending'], true);
|
||||
$reason = (string) ($record['review_note'] ?? $record['provider_result_summary'] ?? '');
|
||||
$can_apply = !empty($settings['enabled']) && !empty($settings['allow_apply']) && $status !== 'verified';
|
||||
$config = [
|
||||
'restBase' => untrailingslashit(rest_url('aksrt/v1/identity/applications')),
|
||||
'nonce' => wp_create_nonce('wp_rest'),
|
||||
'currentUuid' => (string) ($record['application_uuid'] ?? ''),
|
||||
'currentStage' => $stage,
|
||||
'currentUuid' => $locks_application ? (string) ($record['application_uuid'] ?? '') : '',
|
||||
'currentStage' => $locks_application ? $stage : '',
|
||||
'allowManual' => !empty($settings['allow_manual_fallback']),
|
||||
];
|
||||
?>
|
||||
@@ -64,7 +65,7 @@ $config = [
|
||||
<button type="button" class="aksrt-modal__close" data-auth-modal-close aria-label="<?php esc_attr_e('关闭', 'aksrt'); ?>"><i class="fas fa-times" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
<div class="aksrt-modal__body uc-auth-modal__body">
|
||||
<div data-auth-status <?php echo $record === [] ? 'hidden' : ''; ?>>
|
||||
<div data-auth-status <?php echo !$locks_application ? 'hidden' : ''; ?>>
|
||||
<div class="uc-auth-pending">
|
||||
<span><i class="fas fa-shield-alt" aria-hidden="true"></i></span>
|
||||
<h3 data-auth-stage><?php echo esc_html($stage ?: __('准备认证', 'aksrt')); ?></h3>
|
||||
@@ -75,7 +76,7 @@ $config = [
|
||||
<?php if (!empty($settings['allow_manual_fallback'])) : ?><button type="button" class="button" data-auth-manual-open hidden><?php esc_html_e('上传材料转人工审核', 'aksrt'); ?></button><?php endif; ?>
|
||||
</div>
|
||||
|
||||
<form class="aksrt-user-auth-form uc-auth-form" data-auth-create <?php echo $record !== [] ? 'hidden' : ''; ?>>
|
||||
<form class="aksrt-user-auth-form uc-auth-form" data-auth-create <?php echo $locks_application ? 'hidden' : ''; ?>>
|
||||
<label class="uc-auth-field"><span><?php esc_html_e('认证类型', 'aksrt'); ?></span><select class="form-control" name="type" required><option value="personal"><?php esc_html_e('个人认证', 'aksrt'); ?></option><option value="enterprise"><?php esc_html_e('企业认证', 'aksrt'); ?></option></select></label>
|
||||
<div class="uc-auth-enterprise-fields" data-enterprise-fields hidden>
|
||||
<label class="uc-auth-field"><span><?php esc_html_e('企业全称', 'aksrt'); ?></span><input class="form-control" name="company_name" maxlength="191"></label>
|
||||
|
||||
@@ -61,7 +61,7 @@ trait UsersMenusVerify {
|
||||
$status = (string) ($row['status'] ?? '');
|
||||
$total = (int) ($row['total'] ?? 0);
|
||||
$public = \AKSRT\Identity\TransitionService::public_status($status);
|
||||
if ($status === 'manual_pending') {
|
||||
if (in_array($status, ['manual_pending', 'provider_failed', 'provider_unsupported', 'provider_expired'], true)) {
|
||||
$counts['pending'] += $total;
|
||||
} elseif (isset($counts[$public])) {
|
||||
$counts[$public] += $total;
|
||||
@@ -78,7 +78,7 @@ trait UsersMenusVerify {
|
||||
$where = ['1=1'];
|
||||
$params = [];
|
||||
if ($filters['status'] === 'pending') {
|
||||
$where[] = "a.status = 'manual_pending'";
|
||||
$where[] = "a.status IN ('manual_pending','provider_failed','provider_unsupported','provider_expired')";
|
||||
} elseif ($filters['status'] !== '') {
|
||||
$where[] = 'a.status = %s';
|
||||
$params[] = $filters['status'];
|
||||
@@ -162,10 +162,10 @@ trait UsersMenusVerify {
|
||||
|
||||
private function render_verify_actions(array $row): void {
|
||||
$status = (string) $row['status'];
|
||||
if ($status === 'manual_pending') {
|
||||
if (in_array($status, ['manual_pending', 'provider_failed', 'provider_unsupported', 'provider_expired'], true)) {
|
||||
foreach (['verified' => __('通过认证', 'aksrt'), 'rejected' => __('驳回申请', 'aksrt')] as $next => $label) {
|
||||
echo '<form method="post" action="' . esc_url(admin_url('admin-post.php')) . '" style="display:grid;gap:6px;margin-bottom:8px;">';
|
||||
echo '<input type="hidden" name="action" value="aksrt_users_review_verify" /><input type="hidden" name="user_id" value="' . (int) $row['user_id'] . '" /><input type="hidden" name="application_uuid" value="' . esc_attr((string) $row['application_uuid']) . '" /><input type="hidden" name="expected_status" value="manual_pending" /><input type="hidden" name="status" value="' . esc_attr($next) . '" />';
|
||||
echo '<input type="hidden" name="action" value="aksrt_users_review_verify" /><input type="hidden" name="user_id" value="' . (int) $row['user_id'] . '" /><input type="hidden" name="application_uuid" value="' . esc_attr((string) $row['application_uuid']) . '" /><input type="hidden" name="expected_status" value="' . esc_attr($status) . '" /><input type="hidden" name="status" value="' . esc_attr($next) . '" />';
|
||||
wp_nonce_field('aksrt_users_review_verify_' . (int) $row['user_id']);
|
||||
echo '<textarea name="note" rows="2" ' . ($next === 'rejected' ? 'required' : '') . '></textarea><button class="button ' . ($next === 'verified' ? 'button-primary' : '') . '">' . esc_html($label) . '</button></form>';
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ defined('ABSPATH') || exit;
|
||||
final class ApplicationRepository {
|
||||
|
||||
public const ACTIVE_STATUSES = [
|
||||
'created', 'provider_pending', 'provider_processing', 'provider_failed',
|
||||
'provider_unsupported', 'provider_expired', 'manual_pending',
|
||||
'created', 'provider_pending', 'provider_processing', 'manual_pending',
|
||||
];
|
||||
|
||||
private string $table;
|
||||
|
||||
@@ -15,9 +15,9 @@ final class TransitionService {
|
||||
'created' => ['provider_pending', 'provider_failed', 'provider_unsupported', 'provider_expired', 'manual_pending', 'cancelled'],
|
||||
'provider_pending' => ['provider_processing', 'provider_failed', 'provider_unsupported', 'provider_expired', 'verified', 'manual_pending', 'cancelled'],
|
||||
'provider_processing' => ['provider_failed', 'provider_unsupported', 'provider_expired', 'verified', 'manual_pending'],
|
||||
'provider_failed' => ['provider_pending', 'manual_pending', 'cancelled'],
|
||||
'provider_unsupported' => ['manual_pending', 'cancelled'],
|
||||
'provider_expired' => ['provider_pending', 'manual_pending', 'cancelled'],
|
||||
'provider_failed' => ['provider_pending', 'manual_pending', 'rejected', 'cancelled'],
|
||||
'provider_unsupported' => ['manual_pending', 'rejected', 'cancelled'],
|
||||
'provider_expired' => ['provider_pending', 'manual_pending', 'rejected', 'cancelled'],
|
||||
'manual_pending' => ['verified', 'rejected', 'cancelled'],
|
||||
'verified' => ['cancelled'],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user