From 7e18af8233cc700f904c5368c00ea3fb846907cd Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Fri, 15 Jan 2021 15:25:13 +0100 Subject: [PATCH] save --- .../app/src/main/assets/capacitor.config.json | 3 ++ capacitor.config.json | 3 ++ src/app/pages/login/login.page.ts | 7 ++--- src/app/services/auth.service.ts | 30 +------------------ 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/android/app/src/main/assets/capacitor.config.json b/android/app/src/main/assets/capacitor.config.json index e1e79a176..4a2bb66dd 100644 --- a/android/app/src/main/assets/capacitor.config.json +++ b/android/app/src/main/assets/capacitor.config.json @@ -13,5 +13,8 @@ "SplashScreen": "screen", "SplashScreenDelay": "3000" } + }, + "android": { + "allowMixedContent": true } } diff --git a/capacitor.config.json b/capacitor.config.json index e1e79a176..4a2bb66dd 100644 --- a/capacitor.config.json +++ b/capacitor.config.json @@ -13,5 +13,8 @@ "SplashScreen": "screen", "SplashScreenDelay": "3000" } + }, + "android": { + "allowMixedContent": true } } diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 20ae5bdd3..095126a7f 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -67,7 +67,7 @@ export class LoginPage implements OnInit { async Login(){ - try { + /* try { */ //Go to our home in home/feed. //this.router.navigate(['/home/events']); if(this.validateInput()){ @@ -79,7 +79,6 @@ export class LoginPage implements OnInit { } if (await this.authService.login(this.userattempt)){ this.loginRocketChat(); - console.log('Log Gabinete Digital OK'); this.router.navigate(['/home/events']);this.presentAlert('1'); } else @@ -92,9 +91,9 @@ export class LoginPage implements OnInit { //this.toastService.presentToast('Preencha todos campos'); this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.'); } - } catch (error) { + /* } catch (error) { error this.presentAlert('Ocorreu um erro ao fazer login. Contacte o administrador de sistema. '+ error); - } + } */ } } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index f98c62a8d..bdb4ca88e 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -7,7 +7,6 @@ import { environment } from 'src/environments/environment'; import { HttpService } from './http.service'; import { BehaviorSubject, Observable } from 'rxjs'; import { AuthConnstants } from '../config/auth-constants'; -import { AlertController } from '@ionic/angular'; @Injectable({ providedIn: 'root' @@ -18,51 +17,24 @@ export class AuthService { private http: HttpClient, private httpService: HttpService, private storageService:StorageService, - public alertController: AlertController, private router:Router ) { } public ValidatedUser:User; - async presentAlert(message:string) { - const alert = await this.alertController.create({ - cssClass: 'my-custom-class', - header: 'Mensagem do sistema', - message: message, - buttons: ['OK'] - }); - - await alert.present(); - } - async login(user: User): Promise { - user.BasicAuthKey = 'Basic ' + btoa(user.domainName + '\\' + user.username + ':' + user.password); //conversão em base64 das credenciais inseridas - const options = { headers: {'Authorization': user.BasicAuthKey }}; - - const service = environment.apiURL + "userauthentication/GetValidateAuth"; let result: boolean | PromiseLike; - this.presentAlert(service); - try { - result = await this.http.get(service, options).toPromise(); - - } catch (error) { - this.presentAlert('Erro '+error); - } - - + result = await this.http.get(service, options).toPromise(); if (result) { - this.presentAlert('7'); - this.ValidatedUser = user; - this.presentAlert('8'); } return result;