Skip to content

Commit

Permalink
Clear storage and redirect to login on logout; update logout template…
Browse files Browse the repository at this point in the history
… to include login link
  • Loading branch information
miladsoft committed Dec 11, 2024
1 parent 7f610af commit 4405ac8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/app/components/auth/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export class LoginComponent implements OnInit, OnDestroy {
private _nostrLoginService = inject(NostrLoginService);

ngOnInit(): void {
// Clear storage when entering login page
this._signerService.clearPassword();
this._signerService.logout();

this.subscription = this._nostrLoginService.getPublicKeyObservable().subscribe({
next: (pubkey: string) => {
this.publicKey.set(pubkey);
Expand Down
17 changes: 8 additions & 9 deletions src/app/components/auth/logout/logout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
Logging Out
</div>

<!-- Login Link -->
<div class="mt-8 text-center">
<a class="text-primary-500 hover:underline font-medium" [routerLink]="['/login']">
Go to Login
</a>
</div>

<!-- Quick Action Buttons -->
<div class="mt-6 flex flex-col items-center" *ngIf="showConfirm()">
<div class="text-3xl font-bold text-primary-500">
{{countdown()}}
</div>
<div class="mt-2 text-center text-gray-600">
Automatically logging out in {{countdown()}} seconds
</div>
Expand All @@ -31,12 +35,7 @@
</div>
</div>

<!-- Login Link -->
<div class="mt-8 text-center">
<a class="text-primary-500 hover:underline font-medium" [routerLink]="['/login']">
Return to Login
</a>
</div>

</div>
</div>
</div>
2 changes: 1 addition & 1 deletion src/app/components/auth/logout/logout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class LogoutComponent implements OnInit, OnDestroy {
this.countdown.set(this.countdown() - 1);
} else {
clearInterval(this.intervalId);
this.logout();
this._router.navigate(['login']);
}
}, 1000);
}
Expand Down

0 comments on commit 4405ac8

Please sign in to comment.