Skip to content

Commit 6abda5f

Browse files
author
CodeBuddy Attribution Bot
committed
fix(attribution): Skills文档邮箱注册API实现指导不清晰导致注册按钮状态异常 (issue_mnsbor79_tps3mh)
1 parent 99068fd commit 6abda5f

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

config/.claude/skills/auth-web/SKILL.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Keep local `references/...` paths for files that ship with the current skill dir
4444
- Replacing built-in Web auth with cloud function login logic.
4545
- Reusing this flow in Flutter, React Native, or native iOS/Android code.
4646
- Creating a detached helper file with `auth.signUp` / `verifyOtp` but never wiring it into the existing form handlers, so the actual button clicks still do nothing.
47+
- Treating email OTP registration as a one-step API or rebuilding the verification call inside the register handler, so the register button state never matches the real sign-up progress.
4748
- Using `signInWithEmailAndPassword` or `signUpWithEmailAndPassword` for username-style accounts such as `admin` and `editor`.
4849
- Keeping the login or register account input as `type="email"` when the task explicitly says the account identifier is a plain username string.
4950
- Starting implementation before calling `queryAppAuth(action="getLoginConfig")` and enabling `usernamePassword` when it is still off.
@@ -78,6 +79,7 @@ Use the same CDN address as `web-development`. Prefer npm installation in modern
7879
- `auth.signUp({ username, password })` and `auth.signInWithPassword({ username, password })` are the canonical username/password Web auth path
7980
- If the task gives accounts like `admin`, `editor`, or another plain string without `@`, treat it as a username-style identifier rather than an email address
8081
- `verifyOtp({ token })` expects the SMS or email code in `token`
82+
- Email OTP registration is a two-step flow: call `auth.signUp({ email, ... })` in the send-code action, store the returned `data.verifyOtp` handler, then complete registration from the register button with `verifyOtp({ token })`
8183
- `accessKey` is the publishable key from `queryAppAuth` / `manageAppAuth` via `auth-tool-cloudbase`, not a secret key
8284
- Never set `accessKey` to `envId`, a username, or any placeholder string. If you do not have a real Publishable Key yet, do not fabricate one.
8385
- If the task mentions provider setup, stop and read `auth-tool-cloudbase` before writing frontend code
@@ -179,23 +181,24 @@ const handleSendCode = async () => {
179181
try {
180182
const { data, error } = await auth.signUp({
181183
email,
182-
name: username || email.split('@')[0],
184+
nickname: email.split('@')[0],
183185
})
184186
if (error) throw error
185-
setSignUpData(data)
187+
if (!data?.verifyOtp) throw new Error('CloudBase did not return verifyOtp for email sign-up')
188+
setSignUpData(data) // keep the returned verifyOtp handler in component state
186189
} catch (error) {
187190
console.error('Failed to send sign-up code', error)
188191
}
189192
}
190193

194+
const canRegister = !!signUpData?.verifyOtp && code.trim().length > 0
195+
191196
const handleRegister = async () => {
192197
try {
193198
if (!signUpData?.verifyOtp) throw new Error('Please send the code first')
194199

195200
const { error } = await signUpData.verifyOtp({
196-
email,
197201
token: code,
198-
type: 'signup',
199202
})
200203
if (error) throw error
201204
} catch (error) {
@@ -204,6 +207,8 @@ const handleRegister = async () => {
204207
}
205208
```
206209

210+
For split-button register forms, the register button should derive its enabled state from `!!signUpData?.verifyOtp`, the current code input, and any loading flag. Do not call `auth.signUp` again inside `handleRegister`, and do not pass extra fields such as `email` or `type` to `verifyOtp` unless `sdkHints` explicitly says to.
211+
207212
**5. Anonymous**
208213
- Automatically use `auth-tool-cloudbase` to turn on `Anonymous Login` through `manageAppAuth`
209214
```js

0 commit comments

Comments
 (0)