add inativity page

This commit is contained in:
Peter Maquiran
2021-08-27 09:48:51 +01:00
parent bf89001177
commit 6aec4a1d5f
10 changed files with 89 additions and 139 deletions
@@ -38,8 +38,6 @@ export class InactivityPage implements OnInit {
}
ngOnInit() {
// clear local storage
window.localStorage.clear();
let userData = this.localstoreService.get('UserData', {})
@@ -48,19 +46,6 @@ export class InactivityPage implements OnInit {
}
//Function to validade the login inputs
validateUsername() {
return (
this.username.trim().length > 0
);
}
validatePassword() {
return (
this.password.trim().length > 0
);
}
async presentAlert(message: string) {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
@@ -72,22 +57,6 @@ export class InactivityPage implements OnInit {
await alert.present();
}
/* loginRocketChat() {
let postData = {
"user": this.username,
"password": this.password,
}
this.authService.loginChat(postData).subscribe((res: any) => {
console.log(res.data);
this.storageService.store(AuthConnstants.AUTH, res.data);
console.log('Login to Rocket chat OK');
}, (error: any) => {
console.log('Network error');
this.presentAlert('Network error ' + error);
});
} */
getToken() {
this.notificatinsservice.getAndpostToken(this.username);
@@ -95,37 +64,7 @@ export class InactivityPage implements OnInit {
async Login() {
if (this.validateUsername()) {
if(this.validatePassword()){
this.userattempt = {
username: this.username,
password: this.password,
domainName: environment.domain,
BasicAuthKey: ""
}
let attempt = await this.authService.login(this.userattempt)
if (attempt) {
this.authService.loginChat(this.userattempt);
this.getToken();
this.hasSession = true
this.hasPin = false
this.setPin = true
if(!this.hasPin || this.hasPin) {
} else {
this.router.navigate(['/home/events']);
}
}
}
else {
this.toastService.badRequest('Por favor, insira a sua palavra-passe');
}
}
else {
this.toastService.badRequest('Por favor, insira o seu nome de utilizador');
}
}
setCode(code: string) {