MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / Onboard

Function Onboard

freebuff/web/src/app/onboard/page.tsx:73–267  ·  view source on GitHub ↗
({ searchParams }: PageProps)

Source from the content-addressed store, hash-verified

71}
72
73const Onboard = async ({ searchParams }: PageProps) => {
74 const resolvedSearchParams = searchParams ? await searchParams : {}
75 const authCode = resolvedSearchParams.auth_code
76 const referrerName = normalizeReferrer(resolvedSearchParams.referrer)
77 const session = await getServerSession(authOptions)
78 const user = session?.user
79
80 if (!user) {
81 const params = new URLSearchParams()
82 if (authCode) params.set('auth_code', authCode)
83 if (referrerName) params.set('referrer', referrerName)
84 const query = params.toString()
85 const dest = authCode ? '/login' : '/get-started'
86 return redirect(query ? `${dest}?${query}` : dest)
87 }
88
89 if (!authCode) {
90 return (
91 <StatusCard
92 title={
93 referrerName
94 ? `${referrerName} invited you to try Freebuff!`
95 : 'Welcome to Freebuff!'
96 }
97 description=""
98 message="You're all set! Head back to your terminal to continue."
99 />
100 )
101 }
102
103 const authCodeResolution = await resolveCliAuthCode(
104 authCode,
105 consumeCliAuthCodeToken,
106 )
107
108 if (authCodeResolution.status === 'already_consumed') {
109 logger.info(
110 {
111 authCodeLength: authCode.length,
112 authCodeTrimmedLength: authCode.trim().length,
113 authCodeHashPrefix: getCliAuthCodeHashPrefix(authCode),
114 isOpaqueAuthCodeToken: isOpaqueCliAuthCodeToken(authCode),
115 userId: user.id,
116 },
117 'Reused Freebuff CLI auth code token',
118 )
119
120 return (
121 <StatusCard
122 title="Login link already used"
123 description="This browser login link has already been used."
124 message="Return to your terminal to continue, or restart Freebuff if it is still waiting for login."
125 />
126 )
127 }
128
129 if (authCodeResolution.status === 'missing') {
130 logger.info(

Callers

nothing calls this directly

Calls 14

resolveCliAuthCodeFunction · 0.90
getCliAuthCodeHashPrefixFunction · 0.90
isOpaqueCliAuthCodeTokenFunction · 0.90
parseAuthCodeFunction · 0.90
validateAuthCodeFunction · 0.90
isAuthCodeExpiredFunction · 0.90
hasCliSessionForAuthHashFunction · 0.90
checkFingerprintConflictFunction · 0.90
createCliSessionFunction · 0.90
setMethod · 0.80
normalizeReferrerFunction · 0.70

Tested by

no test coverage detected