This commit is contained in:
Peter Maquiran
2022-12-22 12:35:45 +01:00
parent e6caab4aaf
commit 2599942b36
+20 -7
View File
@@ -11,11 +11,11 @@ import { ClearStoreService } from 'src/app/services/clear-store.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
import { ThemeService } from 'src/app/services/theme.service';
import { PermissionService } from 'src/app/services/permission.service';
import { PermissionList } from 'src/app/models/permission/permissionList';
import { MessageModel, DeleteMessageModel } from '../../models/beast-orm';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { ChatService } from 'src/app/services/chat.service';
import { Platform } from '@ionic/angular';
@Component({
@@ -50,7 +50,8 @@ export class LoginPage implements OnInit {
public p: PermissionService,
private RochetChatConnectorService: RochetChatConnectorService,
public ChatSystemService: ChatSystemService,
private ChatService: ChatService
private ChatService: ChatService,
private platform: Platform,
) {}
ngOnInit() {
@@ -101,6 +102,7 @@ export class LoginPage implements OnInit {
async Login() {
if (this.validateUsername()) {
if(this.validatePassword()) {
@@ -129,7 +131,7 @@ export class LoginPage implements OnInit {
this.ChatSystemService.loadChat();
}
this.changeProfileService.runLogin();
this.getToken();
SessionStore.setInativity(true);
@@ -138,16 +140,16 @@ export class LoginPage implements OnInit {
} else {
this.RochetChatConnectorService.logout();
this.clearStoreService.clear();
this.ChatSystemService.clearChat();
SessionStore.delete();
window.localStorage.clear();
await MessageModel.deleteAll()
await DeleteMessageModel.deleteAll()
await MessageModel.deleteAll();
await DeleteMessageModel.deleteAll();
await this.authService.SetSession(attempt, this.userattempt);
this.changeProfileService.run();
@@ -159,7 +161,18 @@ export class LoginPage implements OnInit {
this.getToken();
this.router.navigateByUrl('/pin', { replaceUrl: true });
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
if(this.sessionStore.hasPin) {
this.router.navigateByUrl('/home/events');
} else {
this.router.navigateByUrl('/pin', { replaceUrl: true });
}
} else {
this.router.navigate(['/home/events']);
}
}
}
else{