diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 6fccb2d..aab5a7e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -44,6 +44,7 @@ export class AppComponent { private route: ActivatedRoute, private router: Router ) { + this.checkAndClearLocalStorage(); this.isLoggedIn = this.firebaseService.getCurrentUserId(); } @@ -56,6 +57,19 @@ export class AppComponent { } } + checkAndClearLocalStorage() { + const startTime = localStorage.getItem('sessionTimeJOIN'); + + if (startTime) { + const startTimeMillis = parseInt(startTime); + const currentTime = new Date().getTime(); + const timeDifference = 12 * 60 * 60 * 1000; // 12h + if (currentTime - startTimeMillis > timeDifference) { + localStorage.clear(); + } + } + } + checkPwResetRoute() { this.router.events .pipe(filter((event) => event instanceof NavigationEnd)) diff --git a/src/app/components/contacts/contact-edit-new/contact-form/contact-form.component.html b/src/app/components/contacts/contact-edit-new/contact-form/contact-form.component.html index 24b6ddd..916b2db 100644 --- a/src/app/components/contacts/contact-edit-new/contact-form/contact-form.component.html +++ b/src/app/components/contacts/contact-edit-new/contact-form/contact-form.component.html @@ -121,7 +121,8 @@ }