chore: initial commit of sso-mock SSO login service

Next.js + Mantine mock SSO service providing account/password, phone
verify-code, and Feishu QR login. Issues a one-time sso_code that the
external app exchanges for user info.

Includes:
- Feishu callback fix: guard against duplicate/concurrent /api/login
  submissions of the same single-use authorization code (feishuLogin
  once-guard + memoized onLoginSuccess to stop effect re-fire).
- ADAPTATION_GUIDE.md: how to switch from the in-memory code store to
  the real backend auth/index + inner_get_user_info endpoints.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
zhangheng
2026-07-06 18:09:30 +08:00
commit 37f10118d3
33 changed files with 3058 additions and 0 deletions

17
components/login/store.ts Normal file
View File

@@ -0,0 +1,17 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
interface LoginState {
fingerprint: string
setFingerprint: (fingerprint: string) => void
}
export const useLoginStore = create(
persist<LoginState>(
(set) => ({
fingerprint: '',
setFingerprint: (fingerprint) => set({ fingerprint }),
}),
{ name: 'login-store' }
)
)