1(self["webpackChunkapp"] = self["webpackChunkapp"] || []).push([["default-src_app_pages_student_face-capture_face-capture_page_ts"],{ 2 3/***/ 57427: 4/*!*****************************************************************!*\ 5 !*** ./src/app/pages/student/face-capture/face-capture.page.ts ***! 6 \*****************************************************************/ 7/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 8 9"use strict"; 10__webpack_require__.r(__webpack_exports__); 11/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12/* harmony export */ FaceCapturePage: () => (/* binding */ FaceCapturePage) 13/* harmony export */ }); 14/* harmony import */ var C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */ 89204); 15/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! tslib */ 24398); 16/* harmony import */ var _face_capture_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./face-capture.page.html?ngResource */ 60657); 17/* harmony import */ var _face_capture_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./face-capture.page.scss?ngResource */ 20405); 18/* harmony import */ var _face_capture_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_face_capture_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2__); 19/* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @angular/core */ 37580); 20/* harmony import */ var _ionic_angular__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ionic/angular */ 5995); 21/* harmony import */ var src_app_services_cms_cms_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! src/app/services/cms/cms.service */ 17377); 22/* harmony import */ var src_app_services_course_course_service__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! src/app/services/course/course.service */ 82493); 23/* harmony import */ var src_app_services_photo_photo_service__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! src/app/services/photo/photo.service */ 61665); 24/* harmony import */ var src_app_services_storage_storage_service__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! src/app/services/storage/storage.service */ 85217); 25/* harmony import */ var src_app_services_user_user_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! src/app/services/user/user.service */ 83273); 26/* harmony import */ var _home_modals_face_capture_modal_face_capture_modal_page__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../home/modals/face-capture-modal/face-capture-modal.page */ 94772); 27 28 29 30 31 32 33 34 35 36 37 38 39let FaceCapturePage = class FaceCapturePage { 40 constructor(photoService, modalController, userService, cmsService, navCtrl, courseService, storageService) { 41 this.photoService = photoService; 42 this.modalController = modalController; 43 this.userService = userService; 44 this.cmsService = cmsService; 45 this.navCtrl = navCtrl; 46 this.courseService = courseService; 47 this.storageService = storageService; 48 this.scanActive = false; 49 this.studentUploadPhoto = null; 50 this.submitting = false; 51 this.failedCounter = 0; 52 this.userLastLogout = {}; 53 this.scanActive == true; 54 } 55 ngOnInit() { 56 this.faceStatus = ""; 57 this.studentUploadPhoto = this.imageCap; 58 this.showFaceAgreement(); 59 /* this.photoService.uploadedImageForLogin.subscribe((res) => { 60 if (res) { 61 this.studentUploadPhoto = res; 62 this.invalidImage = this.studentUploadPhoto.validImage; 63 } 64 }); */ 65 } 66 showFaceAgreement() { 67 var _this2 = this; 68 return (0,C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () { 69 const modal2 = yield _this2.modalController.create({ 70 component: _home_modals_face_capture_modal_face_capture_modal_page__WEBPACK_IMPORTED_MODULE_8__.FaceCaptureMod
70alPage, 71 cssClass: 'my-custom-class', 72 backdropDismiss: false, 73 componentProps: { 74 mode: "FACE" 75 } 76 }); 77 modal2.onDidDismiss().then(dataReturned => { 78 _this2.agreed = dataReturned; 79 _this2.scanActive = true; 80 _this2.studentUploadPhoto = _this2.imageCap; 81 //this.startVideo(); 82 }); 83 return yield modal2.present(); 84 })(); 85 } 86 startVideo() { 87 this.scanActive = false; 88 this.video = document.querySelector("video"); 89 navigator.mediaDevices.getUserMedia({ 90 video: { 91 width: 250, 92 height: 250 93 } 94 }).then(stream => { 95 this.video.srcObject = stream; 96 }); 97 } 98 /* captureImage() { 99 this.faceStatus = ""; 100 this.scanActive = true; 101 let canvas = document.createElement('canvas'); 102 this.video = document.getElementById('video'); 103 canvas.width = 1080; 104 canvas.height = 1080; 105 let ctx = canvas.getContext('2d'); 106 ctx.drawImage(this.video, 0, 0, canvas.width, canvas.height); 107 let image = canvas.toDataURL('image/jpeg'); 108 109 this.studentUploadPhoto = image; 110 this.stopVideo(this.video); 111 this.faceVerification(); //with Face Recog 112 //this.faceVerification2(); //No Face Recog 113 } */ 114 captureImage() { 115 this.faceStatus = ""; 116 this.scanActive = true; 117 this.studentUploadPhoto = this.imageCap; 118 //this.faceVerification(); //with Face Recog 119 this.faceVerification2(); //No Face Recog 120 } 121 stopVideo(video) { 122 this.video = video; 123 this.video.pause(); 124 const tracks = this.video.srcObject.getTracks(); 125 tracks[0].stop(); 126 this.video.src = null; 127 this.video = null; 128 }
129 takePicture() { 130 this.photoService.addNewToGallery('login'); 131 } 132 dismiss() { 133 // using the injected ModalController this page 134 // can "dismiss" itself and optionally pass back data 135 //this.stopVideo(this.video); 136 this.modalController.dismiss({ 137 faceVerified: false 138 }); 139 } 140 faceVerified() { 141 // using the injected ModalController this page 142 // can "dismiss" itself and optionally pass back data 143 this.modalController.dismiss({ 144 faceVerified: true 145 }); 146 this.cmsService.successMessageToast('Face Verified. Thank you!'); 147 } 148 updateUserLastLogout(userLastLogout) { 149 this.userLastLogout = userLastLogout; 150 this.userService.updateUserLastLogout(this.userLastLogout).then(res => {}); 151 } 152 updateUserFaceFailedCount(userLastLogout) { 153 this.userLastLogout = userLastLogout; 154 this.userService.updateUserFaceFailedCount(this.userLastLogout).then(res => {}); 155 } 156 faceVerification2() { 157 this.faceStatus = "Checking Face Liveness..."; 158 let i = 1; 159 while (i < 3000) { 160 i++; 161 } 162 this.faceStatus = "Performing Face Recognition..."; 163 i = 1; 164 while (i < 3000) { 165 i++; 166 } 167 this.uploadFaceLog(this.student, this.topic, this.studentUploadPhoto); 168 this.faceStatus = "Face Recognition successfully completed!"; 169 this.submitting = false; 170 this.modalController.dismiss({ 171 faceVerified: true 172 }); 173 } 174 faceVerification() { 175 const getBase64StringFromDataURL = dataURL => dataURL.replace('data:', '').replace(/^.+,/, ''); 176 var _this = this; 177 this.submitting = true; 178 this.faceStatus = "Checking Face Liveness..."; 179 this.userService.checkImageLiveness(getBase64StringFromDataURL(this.studentUploadPhoto)).then(res => { 180 if (res.status == "success" || res.result == "real") { 181 if (res.result == "real") { 182 this.faceStatus = "Gathering Face Info..."; 183 this.userService.getFaceKeyByEmail(this.student.email).then(res => { 184 if (res.statusCode == 200) { 185 console.log("Face Liveness"); 186 this.userPhoto = null; 187 this.faceKey = res.result[0][0].faceKey; 188 this.userPhoto = res.result[0][0].photo; 189 this.faceEmail = this.student.email; 190 this.userService.registerLuxandv2(this.userPhoto, this.faceEmail).then(res => { 191 var uuid = res.uuid; 192 console.log(res); 193 if (res.status == "success") { 194 console.log("Face Registered"); 195 this.faceStatus = "Performing Face Recognition..."; 196 let i = 1; 197 while (i < 3000) { 198 i++; 199 } 200 this.userService.verificationLuxandV2(getBase64StringFromDataURL(this.studentUploadPhoto)).then(res => { 201 //console.log(res); 202 if (res.status == "success" || res[0].name == this.faceEmail) { 203 if (res[0].name == this.faceEmail) { 204 console.log("Face Verified"); 205 //Upload FaceLogs 206 this.uploadFaceLog(this.student, this.topic, this.studentUploadPhoto); 207 this.faceStatus = "Face Recognition successfully completed!"; 208 this.userService.deleteLuxandPerson(uuid).then(res => {}); 209 console.log("deleted Face Data"); 210 //this.userLastLogout.email = this.faceEmail; 211 //this.userLastLogout.faceFailedCount = 0; 212 //this.updateUserFaceFailedCount(this.userLastLogout); 213 this.submitting = false; 214 this.modalController.dismiss({ 215 faceVerified: true 216 }); 217 } else { 218 //this.scanActive = false; 219 //this.studentUploadPhoto = null; 220 //this.startVideo(); 221 this.userService.deleteLuxandPerson(uuid).then(res => {}); 222 console.log("deleted Face Data"); 223 /* this.userLastLogout.email = this.student.email; 224 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 225 this.userLastLogout = data.result[0]; 226 if (this.userLastLogout.faceFailedCount != null) { 227 this.failedCounter = this.userLastLogout.faceFailedCount; 228 this.failedCounter = this.failedCounter + 1; 229 this.userLastLogout.faceFailedCount = this.failedCounter; 230 this.userLastLogout.lastLogout = null; 231 this.userLastLogout.logoutCount = 0; 232 this.updateUserFaceFailedCount(this.userLastLogout); 233 } 234 if (this.failedCounter >= 3) { 235 var now = new Date(); 236 var logOutCount; 237 238 this.cmsService.errorMessageToast( 239 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 240 ); 241 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 242 this.userLastLogout = data.result[0]; 243 logOutCount = this.userLastLogout.logoutCount; 244 logOutCount = logOutCount + 1 245 this.userLastLogout.logoutCount = logOutCount; 246 this.userLastLogout.lastLogout = now.toISOString(); 247 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 248 this.userLastLogout = res.result[0]; 249 logOutCount = this.userLastLogout.logoutCount; 250 if(logOutCount >=3 ){ 251 //execute the reset module function 252 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 253 this.cmsService.errorMessageToast( 254 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 255 ); 256 this.userLastLogout.faceFailedCount = 0; 257 this.userLastLogout.logoutCount = 0; 258 this.userLastLogout.lastLogout = now.toISOString(); 259 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 260 } 261 this.modalController.dismiss({ 262 faceVerified: false, 263 }); 264 this.logout(); 265 }); 266 }); 267 } else { 268 this.cmsService.errorMessageToast( 269 'Unauthorized User. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 270 ); 271 } 272 }); */ 273 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 274 this.submitting = false;
275 } 276 } else { 277 //this.scanActive = false; 278 //this.studentUploadPhoto = null; 279 //this.startVideo(); 280 this.userService.deleteLuxandPerson(uuid).then(res => {}); 281 console.log("deleted Face Data"); 282 /* this.userLastLogout.email = this.student.email; 283 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 284 this.userLastLogout = data.result[0]; 285 if (this.userLastLogout.faceFailedCount != null) { 286 this.failedCounter = this.userLastLogout.faceFailedCount; 287 this.failedCounter = this.failedCounter + 1; 288 this.userLastLogout.faceFailedCount = this.failedCounter; 289 this.userLastLogout.lastLogout = null; 290 this.userLastLogout.logoutCount = 0; 291 this.updateUserFaceFailedCount(this.userLastLogout); 292 } 293 if (this.failedCounter >= 3) { 294 var now = new Date(); 295 var logOutCount; 296 297 this.cmsService.errorMessageToast( 298 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 299 ); 300 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 301 this.userLastLogout = data.result[0]; 302 logOutCount = this.userLastLogout.logoutCount; 303 logOutCount = logOutCount + 1 304 this.userLastLogout.logoutCount = logOutCount; 305 this.userLastLogout.lastLogout = now.toISOString(); 306 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 307 this.userLastLogout = res.result[0]; 308 logOutCount = this.userLastLogout.logoutCount; 309 if(logOutCount >=3 ){ 310 //execute the reset module function 311 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 312 this.cmsService.errorMessageToast( 313 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 314 ); 315 this.userLastLogout.faceFailedCount = 0; 316 this.userLastLogout.logoutCount = 0; 317 this.userLastLogout.lastLogout = now.toISOString(); 318 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 319 } 320 this.modalController.dismiss({ 321 faceVerified: false, 322 }); 323 this.logout(); 324 }); 325 }); 326 } else { 327 this.cmsService.errorMessageToast( 328 'Unauthorized User. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 329 ); 330 } 331 }); */ 332 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 333 this.submitting = false;
334 } 335 }).catch(err => { 336 //this.scanActive = false; 337 //this.studentUploadPhoto = null; 338 //this.startVideo(); 339 this.userService.deleteLuxandPerson(uuid).then(res => {}); 340 console.log("deleted Face Data"); 341 /* this.userLastLogout.email = this.student.email; 342 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 343 this.userLastLogout = data.result[0]; 344 if (this.userLastLogout.faceFailedCount != null) { 345 this.failedCounter = this.userLastLogout.faceFailedCount; 346 this.failedCounter = this.failedCounter + 1; 347 this.userLastLogout.faceFailedCount = this.failedCounter; 348 this.userLastLogout.lastLogout = null; 349 this.userLastLogout.logoutCount = 0; 350 this.updateUserFaceFailedCount(this.userLastLogout); 351 } 352 if (this.failedCounter >= 3) { 353 var now = new Date(); 354 var logOutCount; 355 356 this.cmsService.errorMessageToast( 357 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 358 ); 359 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 360 this.userLastLogout = data.result[0]; 361 logOutCount = this.userLastLogout.logoutCount; 362 logOutCount = logOutCount + 1 363 this.userLastLogout.logoutCount = logOutCount; 364 this.userLastLogout.lastLogout = now.toISOString(); 365 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 366 this.userLastLogout = res.result[0]; 367 logOutCount = this.userLastLogout.logoutCount; 368 if(logOutCount >=3 ){ 369 //execute the reset module function 370 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 371 this.cmsService.errorMessageToast( 372 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 373 ); 374 this.userLastLogout.faceFailedCount = 0; 375 this.userLastLogout.logoutCount = 0; 376 this.userLastLogout.lastLogout = now.toISOString(); 377 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 378 } 379 this.modalController.dismiss({ 380 faceVerified: false, 381 }); 382 this.logout(); 383 }); 384 }); 385 } else { 386 this.cmsService.errorMessageToast( 387 'Unauthorized User. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 388 ); 389 } 390 }); */ 391 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 392 this.submitting = false;
393 }); 394 } else { 395 //this.scanActive = false; 396 //this.studentUploadPhoto = null; 397 //this.startVideo(); 398 /* this.userLastLogout.email = this.student.email; 399 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 400 this.userLastLogout = data.result[0]; 401 if (this.userLastLogout.faceFailedCount != null) { 402 this.failedCounter = this.userLastLogout.faceFailedCount; 403 this.failedCounter = this.failedCounter + 1; 404 this.userLastLogout.faceFailedCount = this.failedCounter; 405 this.userLastLogout.lastLogout = null; 406 this.userLastLogout.logoutCount = 0; 407 this.updateUserFaceFailedCount(this.userLastLogout); 408 } 409 if (this.failedCounter >= 3) { 410 var now = new Date(); 411 var logOutCount; 412 413 this.cmsService.errorMessageToast( 414 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 415 ); 416 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 417 this.userLastLogout = data.result[0]; 418 logOutCount = this.userLastLogout.logoutCount; 419 logOutCount = logOutCount + 1 420 this.userLastLogout.logoutCount = logOutCount; 421 this.userLastLogout.lastLogout = now.toISOString(); 422 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 423 this.userLastLogout = res.result[0]; 424 logOutCount = this.userLastLogout.logoutCount; 425 if(logOutCount >=3 ){ 426 //execute the reset module function 427 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 428 this.cmsService.errorMessageToast( 429 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 430 ); 431 this.userLastLogout.faceFailedCount = 0; 432 this.userLastLogout.logoutCount = 0; 433 this.userLastLogout.lastLogout = now.toISOString(); 434 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 435 } 436 this.modalController.dismiss({ 437 faceVerified: false, 438 }); 439 this.logout(); 440 }); 441 }); 442 } else { 443 this.cmsService.errorMessageToast( 444 'Unauthorized User. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 445 ); 446 } 447 }); */ 448 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 449 this.submitting = false;
450 } 451 }).catch(err => { 452 //this.scanActive = false; 453 //this.studentUploadPhoto = null; 454 //this.startVideo(); 455 /* this.userLastLogout.email = this.student.email; 456 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 457 this.userLastLogout = data.result[0]; 458 if (this.userLastLogout.faceFailedCount != null) { 459 this.failedCounter = this.userLastLogout.faceFailedCount; 460 this.failedCounter = this.failedCounter + 1; 461 this.userLastLogout.faceFailedCount = this.failedCounter; 462 this.userLastLogout.lastLogout = null; 463 this.userLastLogout.logoutCount = 0; 464 this.updateUserFaceFailedCount(this.userLastLogout); 465 } 466 if (this.failedCounter >= 3) { 467 var now = new Date(); 468 var logOutCount; 469 470 this.cmsService.errorMessageToast( 471 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 472 ); 473 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 474 this.userLastLogout = data.result[0]; 475 logOutCount = this.userLastLogout.logoutCount; 476 logOutCount = logOutCount + 1 477 this.userLastLogout.logoutCount = logOutCount; 478 this.userLastLogout.lastLogout = now.toISOString(); 479 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 480 this.userLastLogout = res.result[0]; 481 logOutCount = this.userLastLogout.logoutCount; 482 if(logOutCount >=3 ){ 483 //execute the reset module function 484 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 485 this.cmsService.errorMessageToast( 486 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 487 ); 488 this.userLastLogout.faceFailedCount = 0; 489 this.userLastLogout.logoutCount = 0; 490 this.userLastLogout.lastLogout = now.toISOString(); 491 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 492 } 493 this.modalController.dismiss({ 494 faceVerified: false, 495 }); 496 this.logout(); 497 }); 498 }); 499 } else { 500 this.cmsService.errorMessageToast( 501 err+'. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 502 ); 503 } 504 }); */ 505 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 506 this.submitting = false;
507 }); 508 } else { 509 //this.scanActive = false; 510 //this.studentUploadPhoto = null; 511 //this.startVideo(); 512 /* this.userLastLogout.email = this.student.email; 513 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 514 this.userLastLogout = data.result[0]; 515 if (this.userLastLogout.faceFailedCount != null) { 516 this.failedCounter = this.userLastLogout.faceFailedCount; 517 this.failedCounter = this.failedCounter + 1; 518 this.userLastLogout.faceFailedCount = this.failedCounter; 519 this.userLastLogout.lastLogout = null; 520 this.userLastLogout.logoutCount = 0; 521 this.updateUserFaceFailedCount(this.userLastLogout); 522 } 523 if (this.failedCounter >= 3) { 524 var now = new Date(); 525 var logOutCount; 526 527 this.cmsService.errorMessageToast( 528 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 529 ); 530 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 531 this.userLastLogout = data.result[0]; 532 logOutCount = this.userLastLogout.logoutCount; 533 logOutCount = logOutCount + 1 534 this.userLastLogout.logoutCount = logOutCount; 535 this.userLastLogout.lastLogout = now.toISOString(); 536 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 537 this.userLastLogout = res.result[0]; 538 logOutCount = this.userLastLogout.logoutCount; 539 if(logOutCount >=3 ){ 540 //execute the reset module function 541 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 542 this.cmsService.errorMessageToast( 543 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 544 ); 545 this.userLastLogout.faceFailedCount = 0; 546 this.userLastLogout.logoutCount = 0; 547 this.userLastLogout.lastLogout = now.toISOString(); 548 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 549 } 550 this.modalController.dismiss({ 551 faceVerified: false, 552 }); 553 this.logout(); 554 }); 555 }); 556 } else { 557 this.cmsService.errorMessageToast( 558 errorMessages+'. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 559 ); 560 } 561 }); */ 562 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 563 this.submitting = false;
564 } 565 }).catch(err => { 566 //this.scanActive = false; 567 //this.studentUploadPhoto = null; 568 //this.startVideo(); 569 /* this.userLastLogout.email = this.student.email; 570 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 571 this.userLastLogout = data.result[0]; 572 if (this.userLastLogout.faceFailedCount != null) { 573 this.failedCounter = this.userLastLogout.faceFailedCount; 574 this.failedCounter = this.failedCounter + 1; 575 this.userLastLogout.faceFailedCount = this.failedCounter; 576 this.userLastLogout.lastLogout = null; 577 this.userLastLogout.logoutCount = 0; 578 this.updateUserFaceFailedCount(this.userLastLogout); 579 } 580 if (this.failedCounter >= 3) { 581 var now = new Date(); 582 var logOutCount; 583 584 this.cmsService.errorMessageToast( 585 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 586 ); 587 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 588 this.userLastLogout = data.result[0]; 589 logOutCount = this.userLastLogout.logoutCount; 590 logOutCount = logOutCount + 1 591 this.userLastLogout.logoutCount = logOutCount; 592 this.userLastLogout.lastLogout = now.toISOString(); 593 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 594 this.userLastLogout = res.result[0]; 595 logOutCount = this.userLastLogout.logoutCount; 596 if(logOutCount >=3 ){ 597 //execute the reset module function 598 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 599 this.cmsService.errorMessageToast( 600 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 601 ); 602 this.userLastLogout.faceFailedCount = 0; 603 this.userLastLogout.logoutCount = 0; 604 this.userLastLogout.lastLogout = now.toISOString(); 605 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 606 } 607 this.modalController.dismiss({ 608 faceVerified: false, 609 }); 610 this.logout(); 611 }); 612 }); 613 } else { 614 this.cmsService.errorMessageToast( 615 err+'. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 616 ); 617 } 618 }); */ 619 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 620 this.submitting = false; 621 }); 622 } else { 623 //this.scanActive = false;
624 //this.studentUploadPhoto = null; 625 //this.startVideo(); 626 /* this.userLastLogout.email = this.student.email; 627 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 628 this.userLastLogout = data.result[0]; 629 if (this.userLastLogout.faceFailedCount != null) { 630 this.failedCounter = this.userLastLogout.faceFailedCount; 631 this.failedCounter = this.failedCounter + 1; 632 this.userLastLogout.faceFailedCount = this.failedCounter; 633 this.userLastLogout.lastLogout = null; 634 this.userLastLogout.logoutCount = 0; 635 this.updateUserFaceFailedCount(this.userLastLogout); 636 } 637 if (this.failedCounter >= 3) { 638 var now = new Date(); 639 var logOutCount; 640 641 this.cmsService.errorMessageToast( 642 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 643 ); 644 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 645 this.userLastLogout = data.result[0]; 646 logOutCount = this.userLastLogout.logoutCount; 647 logOutCount = logOutCount + 1 648 this.userLastLogout.logoutCount = logOutCount; 649 this.userLastLogout.lastLogout = now.toISOString(); 650 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 651 this.userLastLogout = res.result[0]; 652 logOutCount = this.userLastLogout.logoutCount; 653 if(logOutCount >=3 ){ 654 //execute the reset module function 655 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 656 this.cmsService.errorMessageToast( 657 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 658 ); 659 this.userLastLogout.faceFailedCount = 0; 660 this.userLastLogout.logoutCount = 0; 661 this.userLastLogout.lastLogout = now.toISOString(); 662 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 663 } 664 this.modalController.dismiss({ 665 faceVerified: false, 666 }); 667 this.logout(); 668 }); 669 }); 670 } else { 671 this.cmsService.errorMessageToast( 672 'Unauthorized User. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 673 ); 674 } 675 }); */ 676 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 677 this.submitting = false; 678 } 679 } else { 680 //this.scanActive = false; 681 //this.studentUploadPhoto = null; 682 //this.startVideo(); 683 /* this.userLastLogout.email = this.student.email; 684 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 685 this.userLastLogout = data.result[0]; 686 if (this.userLastLogout.faceFailedCount != null) { 687 this.failedCounter = this.userLastLogout.faceFailedCount; 688 this.failedCounter = this.failedCounter + 1; 689 this.userLastLogout.faceFailedCount = this.failedCounter; 690 this.userLastLogout.lastLogout = null; 691 this.userLastLogout.logoutCount = 0; 692 this.updateUserFaceFailedCount(this.userLastLogout); 693 } 694 if (this.failedCounter >= 3) { 695 var now = new Date(); 696 var logOutCount; 697 698 this.cmsService.errorMessageToast( 699 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 700 ); 701 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 702 this.userLastLogout = data.result[0]; 703 logOutCount = this.userLastLogout.logoutCount; 704 logOutCount = logOutCount + 1 705 this.userLastLogout.logoutCount = logOutCount; 706 this.userLastLogout.lastLogout = now.toISOString(); 707 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 708 this.userLastLogout = res.result[0]; 709 logOutCount = this.userLastLogout.logoutCount; 710 if(logOutCount >=3 ){ 711 //execute the reset module function 712 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 713 this.cmsService.errorMessageToast( 714 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 715 ); 716 this.userLastLogout.faceFailedCount = 0; 717 this.userLastLogout.logoutCount = 0; 718 this.userLastLogout.lastLogout = now.toISOString(); 719 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 720 } 721 this.modalController.dismiss({ 722 faceVerified: false, 723 }); 724 this.logout(); 725 }); 726 }); 727 } else { 728 this.cmsService.errorMessageToast( 729 'Unauthorized User. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 730 ); 731 } 732 }); */ 733 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 734 this.submitting = false;
735 } 736 }).catch(err => { 737 //this.scanActive = false; 738 //this.studentUploadPhoto = null; 739 //this.startVideo(); 740 /* this.userLastLogout.email = this.student.email; 741 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 742 this.userLastLogout = data.result[0]; 743 if (this.userLastLogout.faceFailedCount != null) { 744 this.failedCounter = this.userLastLogout.faceFailedCount; 745 this.failedCounter = this.failedCounter + 1; 746 this.userLastLogout.faceFailedCount = this.failedCounter; 747 this.userLastLogout.lastLogout = null; 748 this.userLastLogout.logoutCount = 0; 749 this.updateUserFaceFailedCount(this.userLastLogout); 750 } 751 if (this.failedCounter >= 3) { 752 var now = new Date(); 753 var logOutCount; 754 755 this.cmsService.errorMessageToast( 756 'You reached the maximum attempts, and your account will logout automatically. Attempt (' + this.userLastLogout.faceFailedCount + ') out of 3.' 757 ); 758 this.userService.getUserLastLogout(this.student.email).then((data: any) => { 759 this.userLastLogout = data.result[0]; 760 logOutCount = this.userLastLogout.logoutCount; 761 logOutCount = logOutCount + 1 762 this.userLastLogout.logoutCount = logOutCount; 763 this.userLastLogout.lastLogout = now.toISOString(); 764 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => { 765 this.userLastLogout = res.result[0]; 766 logOutCount = this.userLastLogout.logoutCount; 767 if(logOutCount >=3 ){ 768 //execute the reset module function 769 this.courseService.resetStudentModuleStatus(this.moduleId, this.student.id); 770 this.cmsService.errorMessageToast( 771 'You reached the maximum auto logout of the system due to face verification failure. Your progress on the current module will be reset and you need to start again at the first topic of the module.' + " Attempt " + logOutCount +" out of 3." 772 ); 773 this.userLastLogout.faceFailedCount = 0; 774 this.userLastLogout.logoutCount = 0; 775 this.userLastLogout.lastLogout = now.toISOString(); 776 this.userService.updateUserLastLogout(this.userLastLogout).then((res:any) => {}); 777 } 778 this.modalController.dismiss({ 779 faceVerified: false, 780 }); 781 this.logout(); 782 }); 783 }); 784 } else { 785 this.cmsService.errorMessageToast( 786 err+'. Please Try Again.' + " Attempt " + this.userLastLogout.faceFailedCount +" out of 3." 787 ); 788 } 789 }); */ 790 this.cmsService.errorMessageToast('Unauthorized User. Please Try Again.'); 791 this.submitting = false; 792 }); 793 } 794 logout() { 795 this.stopVideo(this.video); 796 localStorage.clear(); 797 this.storageService.clear().then(res => {}); 798 this.navCtrl.navigateRoot('/'); 799 } 800 uploadFaceLog(studentProfile, topic, photo) { 801 var _this3 = this; 802 return (0,C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () { 803 var faceLog = {}; 804 faceLog.userProfileId = studentProfile.id; 805 faceLog.email = studentProfile.email; 806 faceLog.dsProfileId = studentProfile.dsProfileId; 807 faceLog.lastName = studentProfile.lastName; 808 faceLog.firstName = studentProfile.firstName; 809 faceLog.middleName = studentProfile.middleName; 810 faceLog.extensionName = studentProfile.extensionName; 811 faceLog.courseId = topic.courseId; 812 faceLog.courseCode = topic.courseCode; 813 faceLog.courseName = topic.courseName; 814 faceLog.moduleId = topic.moduleId; 815 faceLog.moduleCode = topic.moduleCode; 816 faceLog.topicId = topic.topicId; 817 faceLog.topicCode = topic.topicCode; 818 faceLog.topicName = topic.topicName; 819 faceLog.languageId = topic.languageId; 820 faceLog.languageName = topic.languageName; 821 faceLog.remarks = "Module Captured Photo - " + _this3.mode; 822 faceLog.notes = "Module Captured Photo - " + _this3.mode; 823 const fileName = new Date().getTime() + '.jpeg'; 824 const blobData = yield _this3.readAsBlob(photo, fileName); 825 _this3.userService.uploadFaceLogV2(faceLog, blobData).then(res => {}); 826 })(); 827 } 828 readAsBlob(cameraPhoto, fileName) { 829 return (0,C_Users_admin_Downloads_saferoadsph_saferoadsph_ui_mysql_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function* () { 830 // Fetch the photo, read as a blob, then convert to base64 format 831 const response = yield fetch(cameraPhoto); 832 const blob = yield response.blob(); 833 var file = new File([blob], fileName, { 834 type: blob.type, 835 lastModified: new Date().getTime() 836 }); 837 return file; 838 })(); 839 } 840 static #_ = this.ctorParameters = () => [{ 841 type: src_app_services_photo_photo_service__WEBPACK_IMPORTED_MODULE_5__.PhotoService 842 }, { 843 type: _ionic_angular__WEBPACK_IMPORTED_MODULE_9__.ModalController 844 }, { 845 type: src_app_services_user_user_service__WEBPACK_IMPORTED_MODULE_7__.UserService 846 }, { 847 type: src_app_services_cms_cms_service__WEBPACK_IMPORTED_MODULE_3__.CmsService 848 }, { 849 type: _ionic_angular__WEBPACK_IMPORTED_MODULE_9__.NavController 850 }, { 851 type: src_app_services_course_course_service__WEBPACK_IMPORTED_MODULE_4__.CourseService 852 }, { 853 type: src_app_services_storage_storage_service__WEBPACK_IMPORTED_MODULE_6__.StorageService 854 }]; 855 static #_2 = this.propDecorators = { 856 student: [{ 857 type: _angular_core__WEBPACK_IMPORTED_MODULE_10__.Input 858 }], 859 topic: [{ 860 type: _angular_core__WEBPACK_IMPORTED_MODULE_10__.Input 861 }], 862 mode: [{ 863 type: _angular_core__WEBPACK_IMPORTED_MODULE_10__.Input 864 }], 865 imageCap: [{ 866 type: _angular_core__WEBPACK_IMPORTED_MODULE_10__.Input 867 }] 868 }; 869}; 870FaceCapturePage = (0,tslib__WEBPACK_IMPORTED_MODULE_11__.__decorate)([(0,_angular_core__WEBPACK_IMPORTED_MODULE_10__.Component)({ 871 selector: 'app-face-capture', 872 template: _face_capture_page_html_ngResource__WEBPACK_IMPORTED_MODULE_1__, 873 styles: [(_face_capture_page_scss_ngResource__WEBPACK_IMPORTED_MODULE_2___default())] 874})], FaceCapturePage); 875 876 877/***/ }), 878 879/***/ 20405: 880/*!******************************************************************************!*\ 881 !*** ./src/app/pages/student/face-capture/face-capture.page.scss?ngResource ***! 882 \******************************************************************************/ 883/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 884 885// Imports 886var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(/*! ../../../../../node_modules/css-loader/dist/runtime/sourceMaps.js */ 53142); 887var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../node_modules/css-loader/dist/runtime/api.js */ 35950); 888var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_
888LOADER_API_SOURCEMAP_IMPORT___); 889// Module 890___CSS_LOADER_EXPORT___.push([module.id, ``, "",{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}]); 891// Exports 892module.exports = ___CSS_LOADER_EXPORT___.toString(); 893 894 895/***/ }), 896 897/***/ 60657: 898/*!******************************************************************************!*\ 899 !*** ./src/app/pages/student/face-capture/face-capture.page.html?ngResource ***! 900 \******************************************************************************/ 901/***/ ((module) => { 902 903"use strict"; 904module.exports = "<ion-content>\r\n <div class=\"bg\">\r\n <div class=\"header\">\r\n <ion-grid>\r\n <ion-row>\r\n <ion-col size=\"12\">\r\n <ion-grid>\r\n <ion-row>\r\n <ion-col>\r\n <p>\r\n USER VERIFICATION<br>\r\n <span style=\"font-size: small;\">\r\n Please capture a photo of yourself to continue\r\n Position your face within the designated area of your screen similar to a 2x2 photo. <br>\r\n </span>\r\n <span style=\"font-size: small;\">\r\n The image captured will be shown on your certificate.\r\n </span>\r\n </p>\r\n <p *ngIf=\"failedCounter > 0 \">\r\n <b>Attempt {{failedCounter}} out of 3</b><br>\r\n <span style=\"color: red; font-size: small;\">\r\n After three (3) unsuccessful attempts, you will be logged out.<br>\r\n Check your registered email for instructions on how to log back in.\r\n </span>\r\n </p>\r\n <p *ngIf=\"invalidImage == false\">\r\n <span style=\"color: red; font-size: small;\">\r\n Invalid Image\r\n </span>\r\n </p>\r\n </ion-col>\r\n </ion-row>\r\n <ion-row>\r\n <ion-col size=\"12\" class=\"ion-margin-top\">\r\n <!-- <p class=\"ion-text-center\">\r\n <img *ngIf=\"!studentUploadPhoto\" src=\"assets/img/layout/scan.svg\" class=\"imgScan\"\r\n (click)=\"takePicture()\"/>\r\n <ion-img *ngIf=\"studentUploadPhoto\" (click)=\"takePicture()\" [src]=\"studentUploadPhoto.webviewPath\"\r\n class=\"imgScan\"></ion-img>\r\n </p> -->\r\n<!-- <div id=\"container\" style=\"\r\n width: 250px;\r\n margin: auto;\r\n position: relative;\r\n height: 250px;\r\n margin-top: 50px;\r\n \" [hidden]=\"scanActive\">\r\n <video id=\"video\" width=\"250\" height=\"250\" autoplay muted></video>\r\n </div> -->\r\n <div *ngIf=\"scanActive == true\">\r\n <!-- <ion-img *ngIf=\"!studentUploadPhoto\" src=\"assets/img/layout/scan.svg\" class=\"imgScan\"></ion-img> -->\r\n <ion-img *ngIf=\"studentUploadPhoto\" [src]=\"studentUploadPhoto\" class=\"imgScan\"></ion-img>\r\n </div>\r\n </ion-col>\r\n <ion-col size=\"12\" class=\"ion-margin-top\">\r\n <p><span style=\"font-size: small;\">\r\n Please use <b>Google Chrome</b> for best user experience.<br>\r\n If you opened the link through FB Messenger, Click the 3 dots at the upper right and select open in\r\n browser.\r\n </span></p>\r\n </ion-col>\r\n <ion-col sizeMd=\"6\" offsetMd=\"3\" sizeLg=\"4\" offsetLg=\"4\" size=\"12\" class=\"ion-margin-top\">\r\n <em style=\"font-size: x-small;\" *ngIf=\"submitting == true\">{{faceStatus}}</em>\r\n <ion-spinner color=\"warning\" *ngIf=\"submitting == true\"></ion-spinner>
904\r\n <ion-button color=\"danger\" expand=\"full\" (click)=\"captureImage()\">{{submitting == true ?\r\n 'Submitting...' :\r\n 'Submit'}}</ion-button>\r\n\r\n <!-- <ion-button color=\"danger\" expand=\"full\" [disabled]=\"!studentUploadPhoto || submitting == true\"\r\n (click)=\"faceVerification()\">{{submitting == true ? 'Submitting...' :\r\n 'Submit'}}</ion-button> -->\r\n <ion-button color=\"primary\" expand=\"full\" (click)=\"dismiss()\"\r\n [disabled]=\"submitting == true\">Cancel</ion-button>\r\n </ion-col>\r\n </ion-row>\r\n </ion-grid>\r\n </ion-col>\r\n </ion-row>\r\n </ion-grid>\r\n </div>\r\n </div>\r\n</ion-content>"; 905 906/***/ }) 907 908}]); 909//# sourceMappingURL=default-src_app_pages_student_face-capture_face-capture_page_ts.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.