mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
network security setup to clear text in gabinetedigital.local domain
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||||
<name>Gabinete Digital</name>
|
<name>Gabinete Digital</name>
|
||||||
<description>An awesome Ionic/Cordova app.</description>
|
<description>Aplicação do Gabinete Digital do Presidente da República de Angola</description>
|
||||||
<author email="hi@ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
|
<author email="info@equilibrium.co.ao" href="http://www.equilibrium.co.ao/">Equilibrium Team</author>
|
||||||
<content src="index.html" />
|
<content src="index.html" />
|
||||||
<access origin="*" />
|
<access origin="*" />
|
||||||
<allow-intent href="http://*/*" />
|
<allow-intent href="http://*/*" />
|
||||||
|
|||||||
@@ -2,5 +2,7 @@
|
|||||||
<network-security-config>
|
<network-security-config>
|
||||||
<domain-config cleartextTrafficPermitted="true">
|
<domain-config cleartextTrafficPermitted="true">
|
||||||
<domain includeSubdomains="true">localhost</domain>
|
<domain includeSubdomains="true">localhost</domain>
|
||||||
|
<domain includeSubdomains="true">gabinetedigital.local</domain>
|
||||||
</domain-config>
|
</domain-config>
|
||||||
|
<!-- <base-config cleartextTrafficPermitted="true"/> -->
|
||||||
</network-security-config>
|
</network-security-config>
|
||||||
|
|||||||
@@ -30,13 +30,6 @@ export class LoginPage implements OnInit {
|
|||||||
}
|
}
|
||||||
/* Function to validade the login inputs */
|
/* Function to validade the login inputs */
|
||||||
validateInput(){
|
validateInput(){
|
||||||
this.userattempt = {
|
|
||||||
username: this.username,
|
|
||||||
password: this.password,
|
|
||||||
domainName: "",
|
|
||||||
BasicAuthKey: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
this.username.trim().length > 0
|
this.username.trim().length > 0
|
||||||
&& this.password.trim().length > 0
|
&& this.password.trim().length > 0
|
||||||
@@ -55,8 +48,16 @@ export class LoginPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async Login(){
|
async Login(){
|
||||||
|
try {
|
||||||
//Go to our home in home/feed.
|
//Go to our home in home/feed.
|
||||||
if(this.validateInput()){
|
if(this.validateInput()){
|
||||||
|
this.userattempt = {
|
||||||
|
username: this.username,
|
||||||
|
password: this.password,
|
||||||
|
domainName: environment.domain,
|
||||||
|
BasicAuthKey: ""
|
||||||
|
}
|
||||||
|
|
||||||
if (await this.authService.login(this.userattempt))
|
if (await this.authService.login(this.userattempt))
|
||||||
{
|
{
|
||||||
this.router.navigate(['/home/events']);
|
this.router.navigate(['/home/events']);
|
||||||
@@ -71,5 +72,8 @@ export class LoginPage implements OnInit {
|
|||||||
/* this.toastService.presentToast('Preencha todos campos'); */
|
/* this.toastService.presentToast('Preencha todos campos'); */
|
||||||
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
|
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.presentAlert('Ocorreu um erro ao fazer login. Contacte o administrador de sistema.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export class AuthService {
|
|||||||
public ValidatedUser:User;
|
public ValidatedUser:User;
|
||||||
|
|
||||||
async login(user: User): Promise<boolean> {
|
async login(user: User): Promise<boolean> {
|
||||||
user.domainName = environment.domain;
|
|
||||||
user.BasicAuthKey = 'Basic ' + btoa(user.domainName + '\\' + user.username + ':' + user.password); //conversão em base64 das credenciais inseridas
|
user.BasicAuthKey = 'Basic ' + btoa(user.domainName + '\\' + user.username + ':' + user.password); //conversão em base64 das credenciais inseridas
|
||||||
|
|
||||||
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
||||||
@@ -31,11 +30,7 @@ export class AuthService {
|
|||||||
|
|
||||||
let result: boolean | PromiseLike<boolean>;
|
let result: boolean | PromiseLike<boolean>;
|
||||||
|
|
||||||
try {
|
|
||||||
result = await this.http.get<boolean>(service, options).toPromise();
|
result = await this.http.get<boolean>(service, options).toPromise();
|
||||||
} catch(e) {
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user