mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 21:35:50 +00:00
changed login and api
This commit is contained in:
@@ -27,8 +27,9 @@ export class AuthService {
|
|||||||
|
|
||||||
public ValidatedUser:User;
|
public ValidatedUser:User;
|
||||||
|
|
||||||
async login(user: User): Promise<boolean> {
|
async login(user: User): Promise<any> {
|
||||||
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 */
|
||||||
|
user.BasicAuthKey = 'Basic ' + btoa(user.username + '@' + user.domainName + ':' + user.password); //conversão em base64 das credenciais inseridas
|
||||||
|
|
||||||
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
||||||
this.headers = this.headers.set('Authorization',user.BasicAuthKey);
|
this.headers = this.headers.set('Authorization',user.BasicAuthKey);
|
||||||
@@ -37,27 +38,28 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
const service = environment.apiURL + "userauthentication/GetValidateAuth";
|
const service = environment.apiURL + "userauthentication/GetValidateAuth";
|
||||||
|
|
||||||
let result: boolean | PromiseLike<boolean>;
|
/* let result: boolean | PromiseLike<boolean>; */
|
||||||
let response: any;
|
let response: any;
|
||||||
|
|
||||||
result = await this.http.get<boolean>(service, options).toPromise();
|
/* result = await this.http.get<boolean>(service, options).toPromise(); */
|
||||||
this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).subscribe(res=>{
|
response = await this.http.post<any>(environment.apiURL + "UserAuthentication/Login", '', this.opts).toPromise();
|
||||||
|
/* this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).subscribe(res=>{
|
||||||
this.storageService.store(AuthConnstants.USER, res);
|
this.storageService.store(AuthConnstants.USER, res);
|
||||||
});
|
this.ValidatedUser = user;
|
||||||
|
response = user;
|
||||||
|
console.log(user);
|
||||||
|
}); */
|
||||||
|
|
||||||
|
if (response)
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
{
|
||||||
this.ValidatedUser = user;
|
this.ValidatedUser = user;
|
||||||
|
this.storageService.store(AuthConnstants.USER, response);
|
||||||
}
|
}
|
||||||
return result;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
logout(){
|
logout(){
|
||||||
this.ValidatedUser = null;
|
this.ValidatedUser = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Login to rocketChat server
|
//Login to rocketChat server
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/',
|
apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/',
|
||||||
apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/',
|
/* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */
|
||||||
|
apiChatUrl: 'https://www.tabularium.pt/api/v1/',
|
||||||
domain: 'gabinetedigital.local',
|
domain: 'gabinetedigital.local',
|
||||||
defaultuser: 'paulo.pinto',
|
defaultuser: 'paulo.pinto',
|
||||||
defaultuserpwd: 'tabteste@006'
|
defaultuserpwd: 'tabteste@006'
|
||||||
|
|||||||
Reference in New Issue
Block a user