mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Special charaacter bug solved
This commit is contained in:
@@ -13,6 +13,7 @@ import { Observable, throwError, BehaviorSubject, of } from "rxjs";
|
||||
import { catchError, filter, take, switchMap, tap } from "rxjs/operators";
|
||||
import { SessionStore } from '../store/session.service';
|
||||
import { environment } from "src/environments/environment";
|
||||
import { Router } from "@angular/router";
|
||||
|
||||
@Injectable()
|
||||
export class TokenInterceptor implements HttpInterceptor {
|
||||
@@ -21,7 +22,7 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
null
|
||||
);
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient, private router: Router,) { }
|
||||
|
||||
|
||||
intercept(
|
||||
@@ -74,10 +75,10 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//this method refresh token is declared here temporary beacouse a circular error
|
||||
refreshToken() {
|
||||
|
||||
|
||||
return this.http
|
||||
.put<any>(environment.apiURL + "UserAuthentication/RefreshToken", {
|
||||
refreshToken: SessionStore.user.RefreshToken,
|
||||
@@ -92,6 +93,16 @@ export class TokenInterceptor implements HttpInterceptor {
|
||||
catchError((error) => {
|
||||
SessionStore.user.Authorization = "";
|
||||
SessionStore.user.RefreshToken = "";
|
||||
SessionStore.setInativity(false)
|
||||
/* SessionStore.setUrlBeforeInactivity(this.router.url); */
|
||||
|
||||
if (environment.production) {
|
||||
window.location.pathname = '/auth'
|
||||
} else {
|
||||
/* const pathBeforeGoOut = window.location.pathname */
|
||||
this.router.navigateByUrl('/auth', { replaceUrl: true });
|
||||
|
||||
}
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
|
||||
@@ -258,9 +258,9 @@
|
||||
</div>
|
||||
<div class="schedule-details">
|
||||
<div class="description">
|
||||
<p class="m-0">{{event.event.Subject}}</p>
|
||||
<p class="m-0" [innerHTML]="event.event.Subject">{{event.event.Subject}}</p>
|
||||
</div>
|
||||
<div class="location">{{event.event.Location}}</div>
|
||||
<div class="location" [innerHTML]="event.event.Location">{{event.event.Location}}</div>
|
||||
<div class="font-13 calendar-owner"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{SessionStore.user.FullName}} </div>
|
||||
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
|
||||
</div>
|
||||
|
||||
@@ -24,13 +24,54 @@ export class DomSanitizerService {
|
||||
}
|
||||
|
||||
private encodeSpecialCharacters(input: string): string {
|
||||
const specialCharactersMap: Record<string, string> = {
|
||||
'!': '!',
|
||||
'@': '@',
|
||||
'#': '#',
|
||||
'$': '$',
|
||||
'%': '%',
|
||||
'^': '^',
|
||||
'&': '&',
|
||||
'*': '*',
|
||||
'(': '(',
|
||||
')': ')',
|
||||
'-': '-',
|
||||
'_': '_',
|
||||
'+': '+',
|
||||
'=': '=',
|
||||
'{': '{',
|
||||
'}': '}',
|
||||
'|': '|',
|
||||
'\\': '\',
|
||||
':': ':',
|
||||
';': ';',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
',': ',',
|
||||
'.': '.',
|
||||
'?': '?',
|
||||
'/': '/',
|
||||
'ã': 'ã', // ã
|
||||
'ç': 'ç', // ç
|
||||
'Â': 'Â', // Â
|
||||
'â': 'â', // â
|
||||
'Ã': 'Ã', // Ã
|
||||
};
|
||||
|
||||
return input.replace(/[!@#$%^&*()-_+=\{\}|\\:;"'<>,.?/ãçÂâÃ]/g, match => specialCharactersMap[match] || match);
|
||||
}
|
||||
|
||||
|
||||
// private encodeSpecialCharacters(input: string): string {
|
||||
// You can use a library like DOMPurify to encode special characters
|
||||
return DOMPurify.sanitize(input);
|
||||
// return DOMPurify.sanitize(input);
|
||||
|
||||
// If you don't want to use an external library, you can manually encode
|
||||
// Here's a simple example, you may need to extend this based on your requirements
|
||||
/* return input.replace(/</g, '<').replace(/>/g, '>'); */
|
||||
}
|
||||
// }
|
||||
|
||||
/* sanitizeInput(input: string): string {
|
||||
return this.sanitizer.sanitize(SecurityContext.HTML, input);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="middle" (click)="openOptions()">
|
||||
<p class="title">{{loadedEvent.Subject}}</p>
|
||||
<p class="title" [innerHTML]="loadedEvent.Subject">{{loadedEvent.Subject}}</p>
|
||||
</div>
|
||||
|
||||
<div class="div-icon d-flex align-base">
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="upper-content">
|
||||
<div class="content-location">
|
||||
|
||||
<span class="date">{{loadedEvent.Location}}</span>
|
||||
<span class="date" [innerHTML]="loadedEvent.Location">{{loadedEvent.Location}}</span>
|
||||
|
||||
<div *ngIf="loadedEvent.Organizer">
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ export class NewPublicationPage implements OnInit {
|
||||
multiple: true,
|
||||
});
|
||||
result.files.forEach(async element => {
|
||||
if(this.checkFileType.checkFileType(element.mimeType) == 'image') {
|
||||
if(this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') {
|
||||
this.convertBlobToBase64(element.blob).then((value) => {
|
||||
|
||||
console.log(element.mimeType)
|
||||
|
||||
Reference in New Issue
Block a user