feat: centralize identity creation with router navigation guard
Migrate automatic identity creation from scattered view components to centralized router navigation guard for consistent behavior across all entry points. **Key Changes:** - Add global beforeEach navigation guard in router/index.ts - Remove automatic identity creation from HomeView, ContactsView, InviteOneAcceptView, and OnboardMeetingMembersView - Keep minimal fallback logic in deep link scenarios with logging - Exclude manual identity creation routes (/start, /new-identifier, /import-account) **Benefits:** - Eliminates code duplication and race conditions - Ensures consistent identity creation regardless of entry point - Centralizes error handling with fallback to manual creation - Improves maintainability with single point of change **Files Modified:** - src/router/index.ts: Add navigation guard with identity creation logic - src/views/HomeView.vue: Remove automatic creation, simplify initializeIdentity() - src/views/ContactsView.vue: Add fallback with logging - src/views/InviteOneAcceptView.vue: Add fallback with logging - src/views/OnboardMeetingMembersView.vue: Add fallback with logging **Testing:** - Verified first-time user navigation creates identity automatically - Confirmed existing users bypass creation logic - Validated manual creation routes remain unaffected - Tested deep link scenarios with fallback logic **Documentation:** - Created docs/identity-creation-migration.md with comprehensive details - Includes migration rationale, implementation details, testing scenarios - Documents security considerations and rollback plan Resolves inconsistent identity creation behavior across different app entry points.
This commit is contained in:
@@ -111,7 +111,11 @@ export default class OnboardMeetingMembersView extends Vue {
|
||||
this.firstName = settings?.firstName || "";
|
||||
this.isRegistered = !!settings?.isRegistered;
|
||||
try {
|
||||
// Identity creation should be handled by router guard, but keep as fallback for meeting setup
|
||||
if (!this.activeDid) {
|
||||
logger.info(
|
||||
"[OnboardMeetingMembersView] No active DID found, creating identity as fallback for meeting setup",
|
||||
);
|
||||
this.activeDid = await generateSaveAndActivateIdentity();
|
||||
this.isRegistered = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user