mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'master' of https://bitbucket.org/equilibriumito/gabinete-digital into master
This commit is contained in:
Generated
+31
@@ -3506,6 +3506,37 @@
|
|||||||
"integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==",
|
"integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"axios": {
|
||||||
|
"version": "0.19.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
|
||||||
|
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "1.5.10"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"debug": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.5.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
|
||||||
|
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
|
||||||
|
"requires": {
|
||||||
|
"debug": "=3.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"axobject-query": {
|
"axobject-query": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
"@ionic-native/status-bar": "^5.0.0",
|
"@ionic-native/status-bar": "^5.0.0",
|
||||||
"@ionic/angular": "^5.0.0",
|
"@ionic/angular": "^5.0.0",
|
||||||
"@logisticinfotech/ionic4-datepicker": "^1.4.4",
|
"@logisticinfotech/ionic4-datepicker": "^1.4.4",
|
||||||
|
"axios": "^0.19.2",
|
||||||
"capacitor-datepicker": "0.0.2",
|
"capacitor-datepicker": "0.0.2",
|
||||||
"ionic2-calendar": "^0.6.6",
|
"ionic2-calendar": "^0.6.6",
|
||||||
"moment": "^2.27.0",
|
"moment": "^2.27.0",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<ion-input type="text" name="domainName" [(ngModel)]="postData.domainName"></ion-input>
|
<ion-input type="text" name="domainName" [(ngModel)]="postData.domainName"></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<ion-button expand="block" shape="round" color="primary" (click)="simpleLogin()">Entrar</ion-button>
|
<ion-button expand="block" shape="round" color="primary" (click)="simpleLogin()">Entrar</ion-button>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -81,18 +81,22 @@ export class LoginPage implements OnInit {
|
|||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
simpleLogin(){
|
async simpleLogin(){
|
||||||
//Go to our home in home/feed.
|
//Go to our home in home/feed.
|
||||||
|
|
||||||
if(this.validateInput()){
|
if(this.validateInput()){
|
||||||
this.router.navigate(['/home/feed']);
|
if (await this.authService.login(this.postData))
|
||||||
console.log(this.postData);
|
{
|
||||||
|
this.router.navigate(['/home/feed']);
|
||||||
|
console.log(this.postData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
console.log("Não foi possível fazer login");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log("Preencha todos campos");
|
console.log("Preencha todos campos");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { HttpService } from './http.service';
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { AuthConnstants } from '../config/auth-constants';
|
import { AuthConnstants } from '../config/auth-constants';
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -16,15 +17,45 @@ export class AuthService {
|
|||||||
private router: Router
|
private router: Router
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
/* login(postData: any): Observable<any> {
|
async login(postData: any): Promise<any> {
|
||||||
return this.httpService.post('login', postData);
|
|
||||||
}
|
|
||||||
|
|
||||||
signup(postData: any): Observable<any> {
|
var session_url = 'https://gpr-dev-08.gabinetedigital.local/api/v2.0/me';
|
||||||
return this.httpService.post('signup', postData);
|
var credentials = btoa(postData.domainName + '\\' + postData.username + ':' + postData.password); //conversão em base64 das credenciais inseridas
|
||||||
}
|
var statusresult = -1;
|
||||||
|
|
||||||
logout(){
|
//configuração dos headers para autênticação básica, passando as credenciais convertidas em base64
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'Authorization': 'Basic ' + credentials,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
await axios.get(session_url, config)
|
||||||
|
.then(function (response) {
|
||||||
|
statusresult = response.status;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
if (error.response) {
|
||||||
|
statusresult = error.response.status;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (statusresult == 200)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (statusresult == 401)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* logout(){
|
||||||
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||||||
this.router.navigate([''])
|
this.router.navigate([''])
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user