From ff5b53940d8666a242c49812cc48f2f0a98e4455 Mon Sep 17 00:00:00 2001 From: Ivan Mitev <> Date: Tue, 16 Dec 2025 20:20:13 +0100 Subject: [PATCH 1/2] FIX: Security leak - cleaning logs --- src/app/app.component.ts | 6 ---- .../pages/dashboard/dashboard.component.ts | 19 +----------- .../org-info/org-info.component.ts | 30 ------------------- .../user-info/user-info.component.ts | 7 +---- .../user-profile/user-profile.component.ts | 3 -- src/app/services/event-message.service.ts | 4 --- .../services/refresh-login-service.service.ts | 21 ------------- src/app/shared/header/header.component.ts | 11 ------- 8 files changed, 2 insertions(+), 99 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 991a4490..14dcce95 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -72,10 +72,6 @@ export class AppComponent implements OnInit { this.refreshApi.stopInterval(); let info = ev.value as LoginInfo; - console.log('STARTING INTERVAL') - console.log(info.expire) - console.log(((info.expire - moment().unix()) - 4)) - this.refreshApi.startInterval(((info.expire - moment().unix())-4)*1000, ev); initFlowbite(); //this.refreshApi.startInterval(3000, ev.value); @@ -90,8 +86,6 @@ export class AppComponent implements OnInit { else if (((aux.expire - moment().unix())-4) > 0) { this.refreshApi.stopInterval(); this.refreshApi.startInterval(((aux.expire - moment().unix())-4)*1000, aux); - console.log('token') - console.log(aux.token) initFlowbite(); } this.router.events.subscribe(event => { diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 7eaeaaa4..4069c394 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -85,15 +85,8 @@ export class DashboardComponent implements OnInit, OnDestroy { this.startTagTransition(); }) this.isFilterPanelShown = JSON.parse(this.localStorage.getItem('is_filter_panel_shown') as string); - //this.route.snapshot.paramMap.get('id'); - console.log('--- route data') - console.log(this.route.queryParams) - console.log(this.route.snapshot.queryParamMap.get('token')) if(this.route.snapshot.queryParamMap.get('token') != null){ this.loginService.getLogin(this.route.snapshot.queryParamMap.get('token')).then(data => { - console.log('---- loginangular response ----') - console.log(data) - console.log(data.username) let info = { "id": data.id, "user": data.username, @@ -113,30 +106,20 @@ export class DashboardComponent implements OnInit, OnDestroy { this.localStorage.addLoginInfo(info); this.eventMessage.emitLogin(info); initFlowbite(); - console.log('----') //this.refreshApi.stopInterval(); //this.refreshApi.startInterval(((data.expire - moment().unix())-4)*1000, data); //this.refreshApi.startInterval(3000, data); }) this.router.navigate(['/dashboard']) } else { - console.log('sin token') //this.localStorage.clear() let aux = this.localStorage.getObject('login_items') as LoginInfo; - if (JSON.stringify(aux) != '{}') { - console.log(aux) - console.log('moment') - console.log(aux['expire']) - console.log(moment().unix()) - console.log(aux['expire'] - moment().unix()) - console.log(aux['expire'] - moment().unix() <= 5) - } + // keep stored session data if present } this.showContact = true; this.cdr.detectChanges(); - console.log('----') } ngOnDestroy(): void { diff --git a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts index 522e53dd..2626bf77 100644 --- a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts +++ b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts @@ -168,8 +168,6 @@ export class OrgInfoComponent implements OnInit { getProfile(){ this.contactmediums=[]; this.accountService.getOrgInfo(this.partyId).then(data=> { - console.log('--org info--') - console.log(data) this.profile=data; this.loadProfileData(this.profile) this.loading=false; @@ -207,7 +205,6 @@ export class OrgInfoComponent implements OnInit { }) } for(let i=0; i { this.profileForm.reset(); @@ -262,7 +257,6 @@ export class OrgInfoComponent implements OnInit { error: error => { console.error('There was an error while updating!', error); if(error.error.error){ - console.log(error) this.errorMessage='Error: '+error.error.error; } else { this.errorMessage='There was an error while updating profile!'; @@ -339,7 +333,6 @@ export class OrgInfoComponent implements OnInit { const phoneNumber = parsePhoneNumber(this.phonePrefix.code + this.mediumForm.value.telephoneNumber); if (phoneNumber) { if (!phoneNumber.isValid()) { - console.log('NUMERO INVALIDO') this.mediumForm.controls['telephoneNumber'].setErrors({'invalidPhoneNumber': true}); this.toastVisibility = true; setTimeout(() => { @@ -405,7 +398,6 @@ export class OrgInfoComponent implements OnInit { } } this.mediumForm.reset(); - console.log(this.contactmediums) } removeMedium(medium:any){ @@ -467,7 +459,6 @@ export class OrgInfoComponent implements OnInit { const phoneNumber = parsePhoneNumber(this.phonePrefix.code + this.mediumForm.value.telephoneNumber); if (phoneNumber) { if (!phoneNumber.isValid()) { - console.log('NUMERO INVALIDO') this.mediumForm.controls['telephoneNumber'].setErrors({'invalidPhoneNumber': true}); this.toastVisibility = true; setTimeout(() => { @@ -531,7 +522,6 @@ export class OrgInfoComponent implements OnInit { } selectPrefix(pref:any) { - console.log(pref) this.prefixCheck = false; this.phonePrefix = pref; } @@ -604,32 +594,22 @@ export class OrgInfoComponent implements OnInit { this.mediumForm.get('telephoneNumber')?.setValue(''); this.cdr.detectChanges(); } - console.log(this.mediumForm) - console.log(this.printAllActiveValidators()); } showMedium(){ - console.log('--- SHOW MEDIUM') - console.log(this.mediumForm) - console.log(this.printAllActiveValidators()); - console.log('--value') - console.log(this.mediumForm.get('email')?.value) } printActiveValidators(controlName: string) { const control = this.mediumForm.get(controlName); if (!control || !control.validator) { - console.log(`No active validators for ${controlName}`); return; } const validatorFn = control.validator({} as AbstractControl); if (!validatorFn) { - console.log(`No active validators for ${controlName}`); return; } - console.log(`Active validators for ${controlName}:`, Object.keys(validatorFn)); } printAllActiveValidators() { @@ -648,14 +628,11 @@ export class OrgInfoComponent implements OnInit { if (droppedFile.fileEntry.isFile) { const fileEntry = droppedFile.fileEntry as FileSystemFileEntry; fileEntry.file((file: File) => { - console.log('dropped') if (file) { const reader = new FileReader(); reader.onload = (e: any) => { const base64String: string = e.target.result.split(',')[1]; - console.log('BASE 64....') - console.log(base64String); // You can use this base64 string as needed let fileBody = { content: { name: 'orglogo'+file.name, @@ -685,7 +662,6 @@ export class OrgInfoComponent implements OnInit { } this.attachmentService.uploadFile(fileBody).subscribe({ next: data => { - console.log(data) if(sel=='img'){ if(file.type.startsWith("image")){ this.showImgPreview=true; @@ -699,12 +675,10 @@ export class OrgInfoComponent implements OnInit { } } this.cdr.detectChanges(); - console.log('uploaded') }, error: error => { console.error('There was an error while uploading!', error); if(error.error.error){ - console.log(error) this.errorMessage='Error: '+error.error.error; } else { this.errorMessage='There was an error while uploading the file!'; @@ -726,7 +700,6 @@ export class OrgInfoComponent implements OnInit { } else { // It was a directory (empty directories are added, otherwise only files) const fileEntry = droppedFile.fileEntry as FileSystemDirectoryEntry; - console.log(droppedFile.relativePath, fileEntry); } } } @@ -736,12 +709,9 @@ export class OrgInfoComponent implements OnInit { } public fileOver(event: any){ - console.log(event); } public fileLeave(event: any){ - console.log('leave') - console.log(event); } saveImgFromURL(){ diff --git a/src/app/pages/user-profile/profile-sections/user-info/user-info.component.ts b/src/app/pages/user-profile/profile-sections/user-info/user-info.component.ts index e96dbfcc..ab7b1ffe 100644 --- a/src/app/pages/user-profile/profile-sections/user-info/user-info.component.ts +++ b/src/app/pages/user-profile/profile-sections/user-info/user-info.component.ts @@ -71,10 +71,7 @@ export class UserInfoComponent implements OnInit { } else { let loggedOrg = aux.organizations.find((element: { id: any; }) => element.id == aux.logged_as) this.partyId = loggedOrg.partyId - console.log(aux.organizations) this.accountService.getOrgInfo(this.partyId).then(data=> { - console.log('org') - console.log(data) }) } this.token=aux.token; @@ -87,7 +84,6 @@ export class UserInfoComponent implements OnInit { getProfile(){ this.accountService.getUserInfo(this.partyId).then(data=> { - console.log(data) this.profile=data; this.loadProfileData(this.profile) this.loading=false; @@ -111,8 +107,7 @@ export class UserInfoComponent implements OnInit { "placeOfBirth": this.userProfileForm.value.city, "title": this.userProfileForm.value.treatment, "birthDate": this.userProfileForm.value.birthdate - } - console.log(profile) + } this.accountService.updateUserInfo(this.partyId,profile).subscribe({ next: data => { this.userProfileForm.reset(); diff --git a/src/app/pages/user-profile/user-profile.component.ts b/src/app/pages/user-profile/user-profile.component.ts index 4ad23bad..54e5c67c 100644 --- a/src/app/pages/user-profile/user-profile.component.ts +++ b/src/app/pages/user-profile/user-profile.component.ts @@ -191,8 +191,6 @@ export class UserProfileComponent implements OnInit{ if(elem != null){ if(elem.className.match(cls)){ this.removeClass(elem,cls) - } else { - console.log('already unselected') } } } @@ -200,7 +198,6 @@ export class UserProfileComponent implements OnInit{ selectMenu(elem:HTMLElement| null,cls:string){ if(elem != null){ if(elem.className.match(cls)){ - console.log('already selected') } else { this.addClass(elem,cls) } diff --git a/src/app/services/event-message.service.ts b/src/app/services/event-message.service.ts index eca269d9..560174ca 100644 --- a/src/app/services/event-message.service.ts +++ b/src/app/services/event-message.service.ts @@ -122,14 +122,10 @@ export class EventMessageService { } emitCategoryAdded(cat:Category){ - console.log('event emitter category') - console.log(cat) this.eventMessageSubject.next({ type: 'CategoryAdded', value: cat }); } emitChangedSession(session:any){ - console.log('event eChangedSession') - console.log(session) this.eventMessageSubject.next({ type: 'ChangedSession', value: session }); } diff --git a/src/app/services/refresh-login-service.service.ts b/src/app/services/refresh-login-service.service.ts index 85d39514..c1fe5a15 100644 --- a/src/app/services/refresh-login-service.service.ts +++ b/src/app/services/refresh-login-service.service.ts @@ -25,20 +25,8 @@ export class RefreshLoginServiceService { startInterval(intervalDuration: number, data:any): void { this.intervalObservable = interval(intervalDuration); - console.log('start interval') - console.log(intervalDuration) - this.intervalSubscription = this.intervalObservable.subscribe(() => { - console.log('login subscription') - console.log(data.expire - moment().unix()) - console.log(data.expire - moment().unix() <= 5) - console.log((data.expire - moment().unix()) - 5) - let aux = this.localStorage.getObject('login_items') as LoginInfo; - - console.log('usuario antes') - console.log(aux) - this.api.getLogin(aux['token']).then(refreshed => { this.stopInterval() @@ -54,9 +42,6 @@ export class RefreshLoginServiceService { "logged_as": aux['logged_as'] }); - console.log('usuario despues') - console.log(this.localStorage.getObject('login_items') as LoginInfo) - // Start the interval only if the token has been really refreshed // Otherwise close the session if (refreshed.expire > moment().unix() + 4) { @@ -65,16 +50,11 @@ export class RefreshLoginServiceService { this.stopInterval(); this.localStorage.setObject('login_items',{}); this.api.logout().catch((err) => { - console.log('Something happened') - console.log(err) }) this.router.navigate(['/dashboard']).then(() => { - console.log('LOGOUT MADE') window.location.reload() }).catch((err) => { - console.log('Something happened router') - console.log(err) }) } }) @@ -83,7 +63,6 @@ export class RefreshLoginServiceService { stopInterval(): void { if (this.intervalSubscription) { - console.log('stop interval') this.intervalSubscription.unsubscribe(); } } diff --git a/src/app/shared/header/header.component.ts b/src/app/shared/header/header.component.ts index 40ed522a..0b7de772 100644 --- a/src/app/shared/header/header.component.ts +++ b/src/app/shared/header/header.component.ts @@ -177,13 +177,10 @@ export class HeaderComponent implements OnInit, AfterViewInit, DoCheck, OnDestro let aux = this.localStorage.getObject('login_items') as LoginInfo; - console.log('aux: ' + aux) if(JSON.stringify(aux) != '{}' && (((aux.expire - moment().unix())-4) > 0)) { this.loginInfo=aux; this.is_logged=true; this.orgs=aux.organizations; - console.log('--roles') - console.log(aux.roles) for(let i=0; i < aux.roles.length; i++){ if(aux.roles[i].name == 'admin'){ this.isAdmin=true; @@ -197,11 +194,8 @@ export class HeaderComponent implements OnInit, AfterViewInit, DoCheck, OnDestro for(let i=0;i element.id == aux.logged_as) - console.log('loggedOrg') - console.log(loggedOrg) this.loggedAsOrg=true; this.username=loggedOrg.name; this.usercharacters=(loggedOrg.name.slice(0, 2)).toUpperCase(); @@ -209,7 +203,6 @@ export class HeaderComponent implements OnInit, AfterViewInit, DoCheck, OnDestro for(let i=0;i element.id == aux.logged_as) - console.log('loggedOrg') - console.log(loggedOrg) this.loggedAsOrg=true; this.username=loggedOrg.name; this.usercharacters=(loggedOrg.name.slice(0, 2)).toUpperCase(); @@ -320,7 +311,6 @@ export class HeaderComponent implements OnInit, AfterViewInit, DoCheck, OnDestro } async toggleLogin(){ - console.log('login') this.showLogin=true; //this.api.getLogin() //await (window.location.href='http://localhost:8004/login'); @@ -429,7 +419,6 @@ export class HeaderComponent implements OnInit, AfterViewInit, DoCheck, OnDestro // Get the final URL string let finalUrl = newUrl.toString(); - console.group(finalUrl) verifierUrl = `${verifierUrl}&client_callback=${finalUrl}` this.qrWindow = this.qrVerifier.launchPopup(verifierUrl, 'Scan QR code', 500, 500); From 9ce320e1cf404083c75832d4b6b8c47f02f9a980 Mon Sep 17 00:00:00 2001 From: Ivan Mitev <> Date: Wed, 24 Dec 2025 00:51:22 +0100 Subject: [PATCH 2/2] FIX: Not correct categories showing for the providers catalogues page --- .../categories-filter.component.ts | 37 ++++--------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/src/app/shared/categories-filter/categories-filter.component.ts b/src/app/shared/categories-filter/categories-filter.component.ts index 4eec1704..120c77f0 100644 --- a/src/app/shared/categories-filter/categories-filter.component.ts +++ b/src/app/shared/categories-filter/categories-filter.component.ts @@ -64,36 +64,13 @@ export class CategoriesFilterComponent implements OnInit { for(let i=0; i { - if(data.category){ - for (let i=0; i { - this.findChildrenByParent(categoryInfo); - }) - } - initFlowbite(); - } else { - this.api.getLaunchedCategories().then(data => { - for(let i=0; i < data.length; i++){ - this.findChildren(data[i],data) - } - this.cdr.detectChanges(); - initFlowbite(); - }) - } - }) - } else { - await this.api.getLaunchedCategories().then(data => { - for(let i=0; i < data.length; i++){ - this.findChildren(data[i],data) - } - this.cdr.detectChanges(); - initFlowbite(); - }) - } + await this.api.getLaunchedCategories().then(data => { + for(let i=0; i < data.length; i++){ + this.findChildren(data[i],data) + } + this.cdr.detectChanges(); + initFlowbite(); + }) } ngAfterViewInit() {