forked from jsnbuchanan/crowd-funder-for-time-pwa
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:
@@ -168,6 +168,7 @@ import {
|
||||
NOTIFY_CONTACT_INVALID_DID,
|
||||
NOTIFY_CONTACTS_ADDED_VISIBLE,
|
||||
NOTIFY_CONTACTS_ADDED,
|
||||
NOTIFY_CONTACTS_ADDED_CONFIRM,
|
||||
NOTIFY_CONTACT_IMPORT_ERROR,
|
||||
NOTIFY_CONTACT_IMPORT_CONFLICT,
|
||||
NOTIFY_CONTACT_IMPORT_CONSTRAINT,
|
||||
@@ -328,8 +329,11 @@ export default class ContactsView extends Vue {
|
||||
// this happens when a platform (eg iOS) doesn't include anything after the "=" in a shared link.
|
||||
this.notify.error(NOTIFY_BLANK_INVITE.message, TIMEOUTS.VERY_LONG);
|
||||
} else if (importedInviteJwt) {
|
||||
// make sure user is created
|
||||
// Identity creation should be handled by router guard, but keep as fallback for invite processing
|
||||
if (!this.activeDid) {
|
||||
logger.info(
|
||||
"[ContactsView] No active DID found, creating identity as fallback for invite processing",
|
||||
);
|
||||
this.activeDid = await generateSaveAndActivateIdentity();
|
||||
}
|
||||
// send invite directly to server, with auth for this user
|
||||
@@ -408,15 +412,10 @@ export default class ContactsView extends Vue {
|
||||
// Legacy danger() and warning() methods removed - now using this.notify.error() and this.notify.warning()
|
||||
|
||||
private showOnboardingInfo() {
|
||||
this.$notify(
|
||||
{
|
||||
group: "modal",
|
||||
type: "confirm",
|
||||
title: "They're Added To Your List",
|
||||
text: "Would you like to go to the main page now?",
|
||||
onYes: async () => {
|
||||
this.$router.push({ name: "home" });
|
||||
},
|
||||
this.notify.confirm(
|
||||
NOTIFY_CONTACTS_ADDED_CONFIRM.message,
|
||||
async () => {
|
||||
this.$router.push({ name: "home" });
|
||||
},
|
||||
-1,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user