mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
save
This commit is contained in:
@@ -13,5 +13,8 @@
|
||||
"SplashScreen": "screen",
|
||||
"SplashScreenDelay": "3000"
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"allowMixedContent": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,5 +13,8 @@
|
||||
"SplashScreen": "screen",
|
||||
"SplashScreenDelay": "3000"
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"allowMixedContent": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<boolean> {
|
||||
|
||||
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<boolean>;
|
||||
this.presentAlert(service);
|
||||
|
||||
try {
|
||||
result = await this.http.get<boolean>(service, options).toPromise();
|
||||
|
||||
} catch (error) {
|
||||
this.presentAlert('Erro '+error);
|
||||
}
|
||||
|
||||
|
||||
result = await this.http.get<boolean>(service, options).toPromise();
|
||||
|
||||
if (result)
|
||||
{
|
||||
this.presentAlert('7');
|
||||
|
||||
this.ValidatedUser = user;
|
||||
this.presentAlert('8');
|
||||
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user