Files
device-voice-h5/openspec/changes/update-index-phone-bind-gate/specs/index-phone-bind-gate/spec.md
sexygoat 3f997063f4
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 1m37s
fix: 优化体验
2026-05-09 16:14:06 +08:00

45 lines
2.7 KiB
Markdown

## ADDED Requirements
### Requirement: Login success SHALL NOT own the bind-phone routing decision
The system SHALL stop deciding mandatory bind-phone routing inside the login success handler and SHALL route successful login into the homepage entry flow instead.
#### Scenario: Login succeeds for a user who may need binding
- **WHEN** the user completes login successfully
- **THEN** the system SHALL route the user to `pages/index/index`
- **AND** the system SHALL NOT branch directly from the login page to the bind-phone page based only on login-time routing logic
### Requirement: Index entry SHALL enforce the bind-phone gate
The system SHALL determine whether phone binding is required whenever the homepage is entered and SHALL redirect to the bind-phone page if the current account is not yet bound.
#### Scenario: User enters index and binding is required
- **WHEN** the user enters `pages/index/index`
- **AND** the latest account state indicates the phone is not yet bound
- **THEN** the system SHALL redirect the user from `index` to `pages/bind/bind`
#### Scenario: User enters index and binding is not required
- **WHEN** the user enters `pages/index/index`
- **AND** the latest account state indicates the phone is already bound
- **THEN** the system SHALL keep the user on the homepage
#### Scenario: User re-enters index later without binding
- **WHEN** the user enters `pages/index/index` again through a later navigation path
- **AND** the latest account state still indicates the phone is not yet bound
- **THEN** the system SHALL re-apply the bind-phone redirect
- **AND** the redirect SHALL NOT depend on whether the user just came from the login page
### Requirement: Bind completion SHALL remain compatible with homepage entry
The system SHALL preserve the existing bind-phone completion destination to the homepage while allowing the homepage gate to be the source of truth for whether binding is still required.
#### Scenario: User completes binding and returns to index
- **WHEN** the user completes phone binding successfully
- **THEN** the system SHALL return the user to `pages/index/index`
- **AND** entering `index` afterward SHALL no longer redirect if the account is now bound
### Requirement: Index phone-bind gate SHALL NOT change login or bind API contracts
The system SHALL preserve the existing login API, bind-phone API, token handling, and account retrieval contracts while changing only the routing responsibility.
#### Scenario: Routing responsibility changes without API change
- **WHEN** the new homepage-entry gate is applied
- **THEN** the system SHALL change only where the bind requirement is evaluated for routing
- **AND** the system SHALL NOT require backend API contract changes