Skip to content

Commit a800015

Browse files
authored
FIX: Categories for catalogues fix + cleaning console logs in marketplace dashboard (#177)
* FIX: Security leak - cleaning logs * FIX: Not correct categories showing for the providers catalogues page --------- Co-authored-by: Ivan Mitev <>
1 parent d918243 commit a800015

8 files changed

Lines changed: 2 additions & 99 deletions

File tree

src/app/app.component.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ export class AppComponent implements OnInit {
7272
this.refreshApi.stopInterval();
7373
let info = ev.value as LoginInfo;
7474

75-
console.log('STARTING INTERVAL')
76-
console.log(info.expire)
77-
console.log(((info.expire - moment().unix()) - 4))
78-
7975
this.refreshApi.startInterval(((info.expire - moment().unix())-4)*1000, ev);
8076
initFlowbite();
8177
//this.refreshApi.startInterval(3000, ev.value);
@@ -90,8 +86,6 @@ export class AppComponent implements OnInit {
9086
else if (((aux.expire - moment().unix())-4) > 0) {
9187
this.refreshApi.stopInterval();
9288
this.refreshApi.startInterval(((aux.expire - moment().unix())-4)*1000, aux);
93-
console.log('token')
94-
console.log(aux.token)
9589
initFlowbite();
9690
}
9791
this.router.events.subscribe(event => {

src/app/pages/dashboard/dashboard.component.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
9292
this.startTagTransition();
9393
})
9494
this.isFilterPanelShown = JSON.parse(this.localStorage.getItem('is_filter_panel_shown') as string);
95-
//this.route.snapshot.paramMap.get('id');
96-
console.log('--- route data')
97-
console.log(this.route.queryParams)
98-
console.log(this.route.snapshot.queryParamMap.get('token'))
9995
if(this.route.snapshot.queryParamMap.get('token') != null){
10096
this.loginService.getLogin(this.route.snapshot.queryParamMap.get('token')).then(data => {
101-
console.log('---- loginangular response ----')
102-
console.log(data)
103-
console.log(data.username)
10497
let info = {
10598
"id": data.id,
10699
"user": data.username,
@@ -120,30 +113,20 @@ export class DashboardComponent implements OnInit, OnDestroy {
120113
this.localStorage.addLoginInfo(info);
121114
this.eventMessage.emitLogin(info);
122115
initFlowbite();
123-
console.log('----')
124116
//this.refreshApi.stopInterval();
125117
//this.refreshApi.startInterval(((data.expire - moment().unix())-4)*1000, data);
126118
//this.refreshApi.startInterval(3000, data);
127119
})
128120
this.router.navigate(['/dashboard'])
129121
} else {
130-
console.log('sin token')
131122
//this.localStorage.clear()
132123
let aux = this.localStorage.getObject('login_items') as LoginInfo;
133-
if (JSON.stringify(aux) != '{}') {
134-
console.log(aux)
135-
console.log('moment')
136-
console.log(aux['expire'])
137-
console.log(moment().unix())
138-
console.log(aux['expire'] - moment().unix())
139-
console.log(aux['expire'] - moment().unix() <= 5)
140-
}
124+
// keep stored session data if present
141125
}
142126

143127
this.showContact = true;
144128

145129
this.cdr.detectChanges();
146-
console.log('----')
147130
}
148131

149132
ngOnDestroy(): void {

src/app/pages/user-profile/profile-sections/org-info/org-info.component.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
178178
getProfile(){
179179
this.contactmediums=[];
180180
this.accountService.getOrgInfo(this.partyId).then(data=> {
181-
console.log('--org info--')
182-
console.log(data)
183181
this.profile=data;
184182
this.loadProfileData(this.profile)
185183
this.loading=false;
@@ -217,7 +215,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
217215
})
218216
}
219217
for(let i=0; i<this.contactmediums.length; i++){
220-
console.log(this.contactmediums)
221218
if(this.contactmediums[i].mediumType == 'Email'){
222219
mediums.push({
223220
mediumType: 'Email',
@@ -227,7 +224,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
227224
emailAddress: this.contactmediums[i].characteristic.emailAddress
228225
}
229226
})
230-
console.log(this.contactmediums[i])
231227
} else if(this.contactmediums[i].mediumType == 'PostalAddress'){
232228
mediums.push({
233229
mediumType: this.contactmediums[i].mediumType,
@@ -258,7 +254,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
258254
"contactMedium": mediums,
259255
"partyCharacteristic": chars
260256
}
261-
console.log(profile)
262257
this.accountService.updateOrgInfo(this.partyId,profile).subscribe({
263258
next: data => {
264259
this.profileForm.reset();
@@ -272,7 +267,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
272267
error: error => {
273268
console.error('There was an error while updating!', error);
274269
if(error.error.error){
275-
console.log(error)
276270
this.errorMessage='Error: '+error.error.error;
277271
} else {
278272
this.errorMessage='There was an error while updating profile!';
@@ -349,7 +343,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
349343
const phoneNumber = parsePhoneNumber(this.phonePrefix.code + this.mediumForm.value.telephoneNumber);
350344
if (phoneNumber) {
351345
if (!phoneNumber.isValid()) {
352-
console.log('NUMERO INVALIDO')
353346
this.mediumForm.controls['telephoneNumber'].setErrors({'invalidPhoneNumber': true});
354347
this.toastVisibility = true;
355348
setTimeout(() => {
@@ -415,7 +408,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
415408
}
416409
}
417410
this.mediumForm.reset();
418-
console.log(this.contactmediums)
419411
}
420412

421413
removeMedium(medium:any){
@@ -477,7 +469,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
477469
const phoneNumber = parsePhoneNumber(this.phonePrefix.code + this.mediumForm.value.telephoneNumber);
478470
if (phoneNumber) {
479471
if (!phoneNumber.isValid()) {
480-
console.log('NUMERO INVALIDO')
481472
this.mediumForm.controls['telephoneNumber'].setErrors({'invalidPhoneNumber': true});
482473
this.toastVisibility = true;
483474
setTimeout(() => {
@@ -541,7 +532,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
541532
}
542533

543534
selectPrefix(pref:any) {
544-
console.log(pref)
545535
this.prefixCheck = false;
546536
this.phonePrefix = pref;
547537
}
@@ -614,32 +604,22 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
614604
this.mediumForm.get('telephoneNumber')?.setValue('');
615605
this.cdr.detectChanges();
616606
}
617-
console.log(this.mediumForm)
618-
console.log(this.printAllActiveValidators());
619607

620608
}
621609
showMedium(){
622-
console.log('--- SHOW MEDIUM')
623-
console.log(this.mediumForm)
624-
console.log(this.printAllActiveValidators());
625-
console.log('--value')
626-
console.log(this.mediumForm.get('email')?.value)
627610
}
628611

629612
printActiveValidators(controlName: string) {
630613
const control = this.mediumForm.get(controlName);
631614
if (!control || !control.validator) {
632-
console.log(`No active validators for ${controlName}`);
633615
return;
634616
}
635617

636618
const validatorFn = control.validator({} as AbstractControl);
637619
if (!validatorFn) {
638-
console.log(`No active validators for ${controlName}`);
639620
return;
640621
}
641622

642-
console.log(`Active validators for ${controlName}:`, Object.keys(validatorFn));
643623
}
644624

645625
printAllActiveValidators() {
@@ -658,14 +638,11 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
658638
if (droppedFile.fileEntry.isFile) {
659639
const fileEntry = droppedFile.fileEntry as FileSystemFileEntry;
660640
fileEntry.file((file: File) => {
661-
console.log('dropped')
662641

663642
if (file) {
664643
const reader = new FileReader();
665644
reader.onload = (e: any) => {
666645
const base64String: string = e.target.result.split(',')[1];
667-
console.log('BASE 64....')
668-
console.log(base64String); // You can use this base64 string as needed
669646
let fileBody = {
670647
content: {
671648
name: 'orglogo'+file.name,
@@ -695,7 +672,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
695672
}
696673
this.attachmentService.uploadFile(fileBody).subscribe({
697674
next: data => {
698-
console.log(data)
699675
if(sel=='img'){
700676
if(file.type.startsWith("image")){
701677
this.showImgPreview=true;
@@ -709,12 +685,10 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
709685
}
710686
}
711687
this.cdr.detectChanges();
712-
console.log('uploaded')
713688
},
714689
error: error => {
715690
console.error('There was an error while uploading!', error);
716691
if(error.error.error){
717-
console.log(error)
718692
this.errorMessage='Error: '+error.error.error;
719693
} else {
720694
this.errorMessage='There was an error while uploading the file!';
@@ -736,7 +710,6 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
736710
} else {
737711
// It was a directory (empty directories are added, otherwise only files)
738712
const fileEntry = droppedFile.fileEntry as FileSystemDirectoryEntry;
739-
console.log(droppedFile.relativePath, fileEntry);
740713
}
741714
}
742715
}
@@ -746,12 +719,9 @@ export class OrgInfoComponent implements OnInit, OnDestroy {
746719
}
747720

748721
public fileOver(event: any){
749-
console.log(event);
750722
}
751723

752724
public fileLeave(event: any){
753-
console.log('leave')
754-
console.log(event);
755725
}
756726

757727
saveImgFromURL(){

src/app/pages/user-profile/profile-sections/user-info/user-info.component.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ export class UserInfoComponent implements OnInit, OnDestroy {
8282
} else {
8383
let loggedOrg = aux.organizations.find((element: { id: any; }) => element.id == aux.logged_as)
8484
this.partyId = loggedOrg.partyId
85-
console.log(aux.organizations)
8685
this.accountService.getOrgInfo(this.partyId).then(data=> {
87-
console.log('org')
88-
console.log(data)
8986
})
9087
}
9188
this.token=aux.token;
@@ -98,7 +95,6 @@ export class UserInfoComponent implements OnInit, OnDestroy {
9895

9996
getProfile(){
10097
this.accountService.getUserInfo(this.partyId).then(data=> {
101-
console.log(data)
10298
this.profile=data;
10399
this.loadProfileData(this.profile)
104100
this.loading=false;
@@ -122,8 +118,7 @@ export class UserInfoComponent implements OnInit, OnDestroy {
122118
"placeOfBirth": this.userProfileForm.value.city,
123119
"title": this.userProfileForm.value.treatment,
124120
"birthDate": this.userProfileForm.value.birthdate
125-
}
126-
console.log(profile)
121+
}
127122
this.accountService.updateUserInfo(this.partyId,profile).subscribe({
128123
next: data => {
129124
this.userProfileForm.reset();

src/app/pages/user-profile/user-profile.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,13 @@ export class UserProfileComponent implements OnInit, OnDestroy {
213213
if(elem != null){
214214
if(elem.className.match(cls)){
215215
this.removeClass(elem,cls)
216-
} else {
217-
console.log('already unselected')
218216
}
219217
}
220218
}
221219

222220
selectMenu(elem:HTMLElement| null,cls:string){
223221
if(elem != null){
224222
if(elem.className.match(cls)){
225-
console.log('already selected')
226223
} else {
227224
this.addClass(elem,cls)
228225
}

src/app/services/event-message.service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,10 @@ export class EventMessageService {
126126
}
127127

128128
emitCategoryAdded(cat:Category){
129-
console.log('event emitter category')
130-
console.log(cat)
131129
this.eventMessageSubject.next({ type: 'CategoryAdded', value: cat });
132130
}
133131

134132
emitChangedSession(session:any){
135-
console.log('event eChangedSession')
136-
console.log(session)
137133
this.eventMessageSubject.next({ type: 'ChangedSession', value: session });
138134
}
139135

src/app/services/refresh-login-service.service.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,8 @@ export class RefreshLoginServiceService {
2525
startInterval(intervalDuration: number, data:any): void {
2626
this.intervalObservable = interval(intervalDuration);
2727

28-
console.log('start interval')
29-
console.log(intervalDuration)
30-
3128
this.intervalSubscription = this.intervalObservable.subscribe(() => {
32-
console.log('login subscription')
33-
console.log(data.expire - moment().unix())
34-
console.log(data.expire - moment().unix() <= 5)
35-
console.log((data.expire - moment().unix()) - 5)
36-
3729
let aux = this.localStorage.getObject('login_items') as LoginInfo;
38-
39-
console.log('usuario antes')
40-
console.log(aux)
41-
4230
this.api.getLogin(aux['token']).then(refreshed => {
4331
this.stopInterval()
4432

@@ -54,9 +42,6 @@ export class RefreshLoginServiceService {
5442
"logged_as": aux['logged_as']
5543
});
5644

57-
console.log('usuario despues')
58-
console.log(this.localStorage.getObject('login_items') as LoginInfo)
59-
6045
// Start the interval only if the token has been really refreshed
6146
// Otherwise close the session
6247
if (refreshed.expire > moment().unix() + 4) {
@@ -65,16 +50,11 @@ export class RefreshLoginServiceService {
6550
this.stopInterval();
6651
this.localStorage.setObject('login_items',{});
6752
this.api.logout().catch((err) => {
68-
console.log('Something happened')
69-
console.log(err)
7053
})
7154

7255
this.router.navigate(['/dashboard']).then(() => {
73-
console.log('LOGOUT MADE')
7456
window.location.reload()
7557
}).catch((err) => {
76-
console.log('Something happened router')
77-
console.log(err)
7858
})
7959
}
8060
})
@@ -83,7 +63,6 @@ export class RefreshLoginServiceService {
8363

8464
stopInterval(): void {
8565
if (this.intervalSubscription) {
86-
console.log('stop interval')
8766
this.intervalSubscription.unsubscribe();
8867
}
8968
}

0 commit comments

Comments
 (0)