Add WeChat login binding gate and context-aware auth UX.

Stop auto-creating duplicate accounts on OAuth, add bind-or-register gate,
PC scan login, mobile open-in-WeChat guide, and fix localhost session cookies.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
John
2026-06-15 15:47:19 -07:00
parent 2e14873f2d
commit 3cd322ccfe
19 changed files with 2141 additions and 156 deletions
+25 -1
View File
@@ -668,7 +668,31 @@ CREATE TABLE IF NOT EXISTS h5_wechat_oauth_states (
utm_source VARCHAR(64) NULL,
utm_medium VARCHAR(64) NULL,
utm_campaign VARCHAR(64) NULL,
intent VARCHAR(16) NOT NULL DEFAULT 'login',
bind_user_id CHAR(36) NULL,
auth_mode VARCHAR(8) NOT NULL DEFAULT 'mp',
status VARCHAR(16) NOT NULL DEFAULT 'pending',
result_kind VARCHAR(32) NULL,
result_token VARCHAR(512) NULL,
result_message VARCHAR(255) NULL,
expires_at BIGINT NOT NULL,
created_at BIGINT NOT NULL,
KEY idx_wechat_oauth_state_expires (expires_at)
KEY idx_wechat_oauth_state_expires (expires_at),
KEY idx_wechat_oauth_state_status (status, expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS h5_wechat_pending_binds (
token VARCHAR(64) PRIMARY KEY,
app_id VARCHAR(32) NOT NULL,
openid VARCHAR(64) NOT NULL,
unionid VARCHAR(64) NULL,
nickname VARCHAR(128) NULL,
avatar_url VARCHAR(512) NULL,
return_to VARCHAR(512) NULL,
utm_source VARCHAR(64) NULL,
utm_medium VARCHAR(64) NULL,
utm_campaign VARCHAR(64) NULL,
expires_at BIGINT NOT NULL,
created_at BIGINT NOT NULL,
KEY idx_wechat_pending_expires (expires_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;