Skip to content

Commit

Permalink
Merge pull request #741 from MadhuMosip/develop
Browse files Browse the repository at this point in the history
MOSIP-34584 resolved security hotspots
  • Loading branch information
aranaravi authored Jul 22, 2024
2 parents 5261147 + 04d4a4b commit b0fa628
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class CenterSelectionComponent implements OnInit, OnDestroy {
isMobileView:boolean = false;
showLocationDetails:boolean = true;
showBackBtn:boolean = false;
positions:any;


private keyboardRef: MatKeyboardRef<MatKeyboardComponent>;
Expand Down Expand Up @@ -265,12 +266,12 @@ export class CenterSelectionComponent implements OnInit, OnDestroy {
}

searchInput(){
if(this.searchText.length > 2 && this.searchText.match(/[\p{Letter}\p{Number}\p{Mark}\s]+/gu)){
if(this.searchText.length > 2 && this.searchText.match(/^[a-zA-Z0-9 ]*$/)){
this.isBlankSpace = false;
}else{
this.isBlankSpace = true;
}
if(!this.searchText.match(/[\p{Letter}\p{Number}\p{Mark}\s]+/gu)){
if(!this.searchText.match(/^[a-zA-Z0-9 ]*$/)){
this.showWarningMsg = true;
}else{
this.showWarningMsg = false;
Expand Down Expand Up @@ -376,9 +377,10 @@ export class CenterSelectionComponent implements OnInit, OnDestroy {
getLocation() {
this.REGISTRATION_CENTRES = [];
this.nearbyClicked = true;
if (navigator.geolocation) {
if ("geolocation" in navigator) {
this.showMap = false;
navigator.geolocation.getCurrentPosition((position) => {
this.positions = navigator.geolocation;
this.positions.getCurrentPosition((position) => {
const subs = this.dataService
.getNearbyRegistrationCenters(position.coords)
.subscribe(
Expand All @@ -402,8 +404,7 @@ export class CenterSelectionComponent implements OnInit, OnDestroy {
//this.showErrorMessage(error);
});
this.subscriptions.push(subs);
});
} else {
})
}
}

Expand Down Expand Up @@ -564,26 +565,26 @@ export class CenterSelectionComponent implements OnInit, OnDestroy {
})
} else {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((position) => {
this.positions.getCurrentPosition((position) => {
this.dataService.nearByRegistrationCentersList(this.langCode, position.coords)
.subscribe(response =>{
if (response.headers.get('Content-Type') === 'application/pdf') {
var fileName = "";
const contentDisposition = response.headers.get('Content-Disposition');
if (contentDisposition) {
const fileNameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = fileNameRegex.exec(contentDisposition);
if (matches != null && matches[1]) {
fileName = matches[1].replace(/['"]/g, '');
.subscribe(response =>{
if (response.headers.get('Content-Type') === 'application/pdf') {
var fileName = "";
const contentDisposition = response.headers.get('Content-Disposition');
if (contentDisposition) {
const fileNameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = fileNameRegex.exec(contentDisposition);
if (matches != null && matches[1]) {
fileName = matches[1].replace(/['"]/g, '');
}
}
saveAs(response.body, fileName);
} else {
console.log("");
}
}
saveAs(response.body, fileName);
} else {
console.log("");
}
}, error =>{
}, error =>{
console.log(error);
})
})
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion resident-ui/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" />
<link rel="icon" type="image/x-icon" href="./assets/MOSIP Vertical Black.png">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src="https://www.google.com/recaptcha/api.js" integrity="" async defer></script>
</head>
<body>
<app-root></app-root>
Expand Down

0 comments on commit b0fa628

Please sign in to comment.