diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 4e242d9..de47584 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -697,7 +697,9 @@ export class AppComponent implements OnInit { return; } - this.initializeApp(); + this.initializeApp().then(() => { + this.router.navigate(['/login']); + }); }); } diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 172f86c..7e21912 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -8,13 +8,13 @@ import {Router} from '@angular/router'; templateUrl: 'home.page.html', styleUrls: ['home.page.scss'], }) -export class HomePage implements OnInit { +export class HomePage { constructor( public readonly api: ApiService, public readonly router: Router, ) {} - ngOnInit() { + ionViewDidEnter() { if ( !this.api.isAuthenticated || this.api.isPublicUser ) { if ( isDebug() ) { debug('Forcing authentication...'); diff --git a/src/app/pages/login/login.page.html b/src/app/pages/login/login.page.html index 4034417..3fa370f 100644 --- a/src/app/pages/login/login.page.html +++ b/src/app/pages/login/login.page.html @@ -23,6 +23,7 @@ [(ngModel)]="username" [disabled]="step !== 'username'" placeholder="Username" + (keyup.enter)="advance()" > @@ -31,6 +32,7 @@ [(ngModel)]="password" placeholder="Password" type="password" + (keyup.enter)="advance()" > @@ -53,6 +55,7 @@ [(ngModel)]="passwordConfirm" placeholder="Confirm Password" type="password" + (keyup.enter)="advance()" >
@@ -91,4 +94,4 @@ -
\ No newline at end of file + diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 1a6cb78..f9c69cf 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -1,4 +1,4 @@ -import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; +import {Component, ElementRef, HostListener, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {AlertController, IonInput, LoadingController, ModalController, PopoverController} from '@ionic/angular'; import {EditorService} from '../../service/editor.service'; diff --git a/src/app/service/auth.service.ts b/src/app/service/auth.service.ts index 4085aab..32d4bd6 100644 --- a/src/app/service/auth.service.ts +++ b/src/app/service/auth.service.ts @@ -51,9 +51,10 @@ export class AuthService implements CanActivate { await this.db.purge(); await this.api.endSession(); - await this.router.navigate(['/login']); await loader.dismiss(); this.nav.requestInitialization(); + + await this.router.navigate(['/login']); } }