This commit is contained in:
25
openspec/changes/update-index-phone-bind-gate/proposal.md
Normal file
25
openspec/changes/update-index-phone-bind-gate/proposal.md
Normal file
@@ -0,0 +1,25 @@
|
||||
## Why
|
||||
|
||||
The current login flow decides whether to send the user to the bind-phone page based on `loginData.need_bind_phone`. This makes the phone-binding gate happen only at login time, which is fragile because the actual requirement belongs to entering the homepage, not only to completing login. As a result, the app can enter an inconsistent state when the user reaches `index` through other paths or when the latest bind requirement should be re-evaluated on homepage entry.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Move the mandatory phone-binding gate out of `pages/login/login.vue`
|
||||
- Make login success redirect to `pages/index/index` consistently
|
||||
- Require `pages/index/index.vue` to check whether the current account still needs phone binding every time the page is entered
|
||||
- Redirect to `pages/bind/bind` from `index` when binding is required, instead of deciding that only during login
|
||||
- Keep the bind-phone page as the place where the user completes the required binding flow
|
||||
|
||||
## Capabilities
|
||||
|
||||
### New Capabilities
|
||||
- `index-phone-bind-gate`: Define homepage-entry binding rules so phone binding is enforced from `index` instead of only from login
|
||||
|
||||
### Modified Capabilities
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected code: `pages/login/login.vue`, `pages/index/index.vue`, `pages/bind/bind.vue`
|
||||
- Affected flow: post-login routing, homepage entry, mandatory bind-phone redirect
|
||||
- No backend API changes
|
||||
- No login credential or bind-phone API contract changes
|
||||
@@ -0,0 +1,44 @@
|
||||
## 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
|
||||
23
openspec/changes/update-index-phone-bind-gate/tasks.md
Normal file
23
openspec/changes/update-index-phone-bind-gate/tasks.md
Normal file
@@ -0,0 +1,23 @@
|
||||
## 1. Login Redirect Responsibility
|
||||
|
||||
- [x] 1.1 Remove the bind-phone branching decision from the login success handler
|
||||
- [x] 1.2 Make login success enter `pages/index/index` consistently
|
||||
|
||||
## 2. Index Entry Binding Gate
|
||||
|
||||
- [x] 2.1 Add a homepage-entry binding check in `pages/index/index.vue`
|
||||
- [x] 2.2 Re-evaluate whether binding is required every time `index` is entered, not only after login
|
||||
- [x] 2.3 Redirect from `index` to the bind-phone page when binding is still required
|
||||
|
||||
## 3. Bind Flow Compatibility
|
||||
|
||||
- [x] 3.1 Keep the bind-phone completion flow returning to `index`
|
||||
- [x] 3.2 Ensure users who are already bound are not redirected away from `index`
|
||||
- [x] 3.3 Ensure users who return to `index` without binding are checked again and redirected again if binding is still required
|
||||
|
||||
## 4. Regression Verification
|
||||
|
||||
- [x] 4.1 Verify login success always routes into `index`
|
||||
- [x] 4.2 Verify entering `index` without a bound phone redirects to the bind page
|
||||
- [x] 4.3 Verify entering `index` with a bound phone stays on the homepage
|
||||
- [x] 4.4 Verify re-entering `index` through later navigation still rechecks binding state
|
||||
Reference in New Issue
Block a user