How to use matchFinger method in root

Best JavaScript code snippet using root

mfs100Scripts.js

Source:mfs100Scripts.js Github

copy

Full Screen

1var flag = 0;2var quality = 60; //(1 to 100) (recommanded minimum 55)3var timeout = 10; // seconds (minimum=10(recommanded), maximum=60, unlimited=0 )4//function to initialize the device5function GetInfo() {6 document.getElementById('tdSerial').innerHTML = "";7 document.getElementById('tdCertification').innerHTML = "";8 document.getElementById('tdMake').innerHTML = "";9 document.getElementById('tdModel').innerHTML = "";10 document.getElementById('tdWidth').innerHTML = "";11 document.getElementById('tdHeight').innerHTML = "";12 document.getElementById('tdLocalMac').innerHTML = "";13 document.getElementById('tdLocalIP').innerHTML = "";14 document.getElementById('tdSystemID').innerHTML = "";15 document.getElementById('tdPublicIP').innerHTML = "";16 var key = document.getElementById('txtKey').value;17 var res;18 if (key.length == 0) {19 res = GetMFS100Info();20 } else {21 res = GetMFS100KeyInfo(key);22 }23 if (res.httpStaus) {24 document.getElementById('txtStatus').value = "ErrorCode: " + res.data.ErrorCode + " ErrorDescription: " + res.data.ErrorDescription;25 if (res.data.ErrorCode == "0") {26 document.getElementById('tdSerial').innerHTML = res.data.DeviceInfo.SerialNo;27 document.getElementById('tdCertification').innerHTML = res.data.DeviceInfo.Certificate;28 document.getElementById('tdMake').innerHTML = res.data.DeviceInfo.Make;29 document.getElementById('tdModel').innerHTML = res.data.DeviceInfo.Model;30 document.getElementById('tdWidth').innerHTML = res.data.DeviceInfo.Width;31 document.getElementById('tdHeight').innerHTML = res.data.DeviceInfo.Height;32 document.getElementById('tdLocalMac').innerHTML = res.data.DeviceInfo.LocalMac;33 document.getElementById('tdLocalIP').innerHTML = res.data.DeviceInfo.LocalIP;34 document.getElementById('tdSystemID').innerHTML = res.data.DeviceInfo.SystemID;35 document.getElementById('tdPublicIP').innerHTML = res.data.DeviceInfo.PublicIP;36 }37 } else {38 alert(res.err);39 }40 return false;41}42//function to capture the finger prints. 43function Capture() {44 try {45 document.getElementById('txtStatus').value = "";46 document.getElementById('imgFinger').src = "data:image/bmp;base64,";47 document.getElementById('txtImageInfo').value = "";48 document.getElementById('txtIsoTemplate').value = "";49 document.getElementById('txtAnsiTemplate').value = "";50 document.getElementById('txtIsoImage').value = "";51 document.getElementById('txtRawData').value = "";52 document.getElementById('txtWsqData').value = "";53 var res = CaptureFinger(quality, timeout);54 if (res.httpStaus) {55 flag = 1;56 document.getElementById('txtStatus').value = "ErrorCode: " + res.data.ErrorCode + " ErrorDescription: " + res.data.ErrorDescription;57 if (res.data.ErrorCode == "0") {58 document.getElementById('imgFinger').src = "data:image/bmp;base64," + res.data.BitmapData;59 var imageinfo = "Quality: " + res.data.Quality + " Nfiq: " + res.data.Nfiq + " W(in): " + res.data.InWidth + " H(in): " + res.data.InHeight + " area(in): " + res.data.InArea + " Resolution: " + res.data.Resolution + " GrayScale: " + res.data.GrayScale + " Bpp: " + res.data.Bpp + " WSQCompressRatio: " + res.data.WSQCompressRatio + " WSQInfo: " + res.data.WSQInfo;60 document.getElementById('txtImageInfo').value = imageinfo;61 document.getElementById('txtIsoTemplate').value = res.data.IsoTemplate;62 document.getElementById('txtAnsiTemplate').value = res.data.AnsiTemplate;63 document.getElementById('txtIsoImage').value = res.data.IsoImage;64 document.getElementById('txtRawData').value = res.data.RawData;65 document.getElementById('txtWsqData').value = res.data.WsqImage;66 }67 } else {68 alert(res.err);69 }70 } catch (e) {71 alert(e);72 }73 return false;74}75function Verify() {76 try {77 var isotemplate = document.getElementById('txtIsoTemplate').value;78 var res = VerifyFinger(isotemplate, isotemplate);79 if (res.httpStaus) {80 if (res.data.Status) {81 alert("Finger matched");82 } else {83 if (res.data.ErrorCode != "0") {84 alert(res.data.ErrorDescription);85 } else {86 alert("Finger not matched");87 }88 }89 } else {90 alert(res.err);91 }92 } catch (e) {93 alert(e);94 }95 return false;96}97// function Match() {98// try {99// var isotemplate = document.getElementById('txtIsoTemplate').value;100// var res = MatchFinger(quality, timeout, isotemplate);101// if (res.httpStaus) {102// if (res.data.Status) {103// alert("Finger matched");104// } else {105// if (res.data.ErrorCode != "0") {106// alert(res.data.ErrorDescription);107// } else {108// alert("Finger not matched");109// }110// }111// } else {112// alert(res.err);113// }114// } catch (e) {115// alert(e);116// }117// return false;118// }119function Match(userID) {120 try {121 // var user_id = document.getElementById('user_id').value;122 var x="txtIsoTemplate" + userID;123 // alert(x);124 var isotemplate = document.getElementById(x).value;125 // alert(userID);126 // alert(isotemplate);127 var res = MatchFinger(quality, timeout, isotemplate);128 if (res.httpStaus) {129 if (res.data.Status) {130 alert("Finger Matched");131 // alert(userID);132 let base_url = "{{ url('') }}";133 // let path = 'http://127.0.0.1:8000/log/fingerprintCheckInOrOut/' + userID;134 let path = 'http://127.0.0.1:8000/log/fingerprintCheckInOrOut/' + userID;135 let url = base_url + path;136 // alert(path);137 $.ajax({138 url: path,139 type: 'GET',140 contentType: false,141 processData: false,142 143 success: function(res) {144 alert(res);145 146 },147 error: function(response) {148 alert(userID);149 }150 }151 );152 153 // }154 155 }else {156 if (res.data.ErrorCode != "0") {157 alert(res.data.ErrorDescription);158 } else {159 alert("Finger not matched");160 }161 }162 } else {163 alert(res.err);164 165 }166 } catch (e) {167 alert(e);168 }169 return false;170}171// function Match(userID) {172// try {173// // var user_id = document.getElementById('user_id').value;174// var isotemplate = document.getElementById('txtIsoTemplate').value;175// var res = MatchFinger(quality, timeout, isotemplate);176// if (res.httpStaus) {177// if (res.data.Status) {178// alert("Finger Matched");179// // alert(userID);180// let base_url = "{{ url('') }}";181// // let path = 'http://127.0.0.1:8000/log/fingerprintCheckInOrOut/' + userID;182// let path = 'http://127.0.0.1:8000/log/fingerprintCheckInOrOut/' + userID;183// let url = base_url + path;184// // alert(path);185// $.ajax({186// url: path,187// type: 'GET',188// contentType: false,189// processData: false,190 191// success: function(res) {192// alert(res);193 194// },195// error: function(response) {196// alert(userID);197// }198// }199// );200 201// // }202 203// }else {204// if (res.data.ErrorCode != "0") {205// alert(res.data.ErrorDescription);206// } else {207// alert("Finger not matched");208// }209// }210// } else {211// alert(res.err);212 213// }214// } catch (e) {215// alert(e);216// }217// return false;218// }219 function Hit(){220 $.ajax({221 type:'POST',222 url:'/matchFingerPrint',223 data:'_token = <?php echo csrf_token() ?>',224 success: function(data){225 alert(data.message);226 },227 error: function(errorMessage){228 alert('error');229 }230 })231 return false;232 }233function GetPid() {234 try {235 var isoTemplateFMR = document.getElementById('txtIsoTemplate').value;236 var isoImageFIR = document.getElementById('txtIsoImage').value;237 var Biometrics = Array(); // You can add here multiple FMR value238 Biometrics["0"] = new Biometric("FMR", isoTemplateFMR, "UNKNOWN", "", "");239 var res = GetPidData(Biometrics);240 if (res.httpStaus) {241 if (res.data.ErrorCode != "0") {242 alert(res.data.ErrorDescription);243 } else {244 document.getElementById('txtPid').value = res.data.PidData.Pid245 document.getElementById('txtSessionKey').value = res.data.PidData.Sessionkey246 document.getElementById('txtHmac').value = res.data.PidData.Hmac247 document.getElementById('txtCi').value = res.data.PidData.Ci248 document.getElementById('txtPidTs').value = res.data.PidData.PidTs249 }250 } else {251 alert(res.err);252 }253 } catch (e) {254 alert(e);255 }256 return false;257}258function GetProtoPid() {259 try {260 var isoTemplateFMR = document.getElementById('txtIsoTemplate').value;261 var isoImageFIR = document.getElementById('txtIsoImage').value;262 var Biometrics = Array(); // You can add here multiple FMR value263 Biometrics["0"] = new Biometric("FMR", isoTemplateFMR, "UNKNOWN", "", "");264 var res = GetProtoPidData(Biometrics);265 if (res.httpStaus) {266 if (res.data.ErrorCode != "0") {267 alert(res.data.ErrorDescription);268 } else {269 document.getElementById('txtPid').value = res.data.PidData.Pid270 document.getElementById('txtSessionKey').value = res.data.PidData.Sessionkey271 document.getElementById('txtHmac').value = res.data.PidData.Hmac272 document.getElementById('txtCi').value = res.data.PidData.Ci273 document.getElementById('txtPidTs').value = res.data.PidData.PidTs274 }275 } else {276 alert(res.err);277 }278 } catch (e) {279 alert(e);280 }281 return false;282}283function GetRbd() {284 try {285 var isoTemplateFMR = document.getElementById('txtIsoTemplate').value;286 var isoImageFIR = document.getElementById('txtIsoImage').value;287 var Biometrics = Array();288 Biometrics["0"] = new Biometric("FMR", isoTemplateFMR, "LEFT_INDEX", 2, 1);289 Biometrics["1"] = new Biometric("FMR", isoTemplateFMR, "LEFT_MIDDLE", 2, 1);290 // Here you can pass upto 10 different-different biometric object.291 var res = GetRbdData(Biometrics);292 if (res.httpStaus) {293 if (res.data.ErrorCode != "0") {294 alert(res.data.ErrorDescription);295 } else {296 document.getElementById('txtPid').value = res.data.RbdData.Rbd297 document.getElementById('txtSessionKey').value = res.data.RbdData.Sessionkey298 document.getElementById('txtHmac').value = res.data.RbdData.Hmac299 document.getElementById('txtCi').value = res.data.RbdData.Ci300 document.getElementById('txtPidTs').value = res.data.RbdData.RbdTs301 }302 } else {303 alert(res.err);304 }305 } catch (e) {306 alert(e);307 }308 return false;309}310function GetProtoRbd() {311 try {312 var isoTemplateFMR = document.getElementById('txtIsoTemplate').value;313 var isoImageFIR = document.getElementById('txtIsoImage').value;314 var Biometrics = Array();315 Biometrics["0"] = new Biometric("FMR", isoTemplateFMR, "LEFT_INDEX", 2, 1);316 Biometrics["1"] = new Biometric("FMR", isoTemplateFMR, "LEFT_MIDDLE", 2, 1);317 // Here you can pass upto 10 different-different biometric object.318 var res = GetProtoRbdData(Biometrics);319 if (res.httpStaus) {320 if (res.data.ErrorCode != "0") {321 alert(res.data.ErrorDescription);322 } else {323 document.getElementById('txtPid').value = res.data.RbdData.Rbd324 document.getElementById('txtSessionKey').value = res.data.RbdData.Sessionkey325 document.getElementById('txtHmac').value = res.data.RbdData.Hmac326 document.getElementById('txtCi').value = res.data.RbdData.Ci327 document.getElementById('txtPidTs').value = res.data.RbdData.RbdTs328 }329 } else {330 alert(res.err);331 }332 } catch (e) {333 alert(e);334 }335 return false;336}337function validateform() {338 var password1 = document.myform.exampleInputPassword1;339 var email = document.myform.exampleInputEmail1.value;340 if (email.length > 20) {341 alert("username can be max 25 char");342 return false;343 }344 if (password1.length > 8) {345 alert("password should be max 8 char");346 return false;347 }348 // password matching349 if (password1 == password2) {350 return true;351 } else {352 alert("password not matched");353 return false;354 }...

Full Screen

Full Screen

authentication.js

Source:authentication.js Github

copy

Full Screen

1// Requiring packages that will be used.2var jsdom = require("jsdom"); // jsdom needed for jQuery to work in node.3var express = require("express"); // express for router4const path = require("path");5const { JSDOM } = jsdom;6const { window } = new JSDOM();7const { document } = new JSDOM("").window;8var $ = (jQuery = require("jquery")(window)); // Creating a window where the jQuery can execute since this is backend.9global.document = document;10const router = express.Router(); // Router for routing to other pages in routes and also to refer in app.js11//var uri = "https://localhost:8003/mfs100/"; //Secure [Not used now because of certificate issue]12var uri = "http://localhost:8004/mfs100/"; // Not secure but works for now.13// Function to call when a POST request is made to authentication.js14function MatchFinger(quality, timeout, existingFingerprint) {15 //Parameters are set in the calling function. Hardcoded for now, can make var16 // Creating an Object to pass data to the next function17 var MFS100Request = {18 Quality: quality,19 TimeOut: timeout,20 GalleryTemplate: existingFingerprint,21 BioType: "FMR", // you can paas here BioType as "ANSI" if you are using ANSI Template22 };23 var jsonData = JSON.stringify(MFS100Request); // Converting the object to a string so that it can be used in Ajax request.24 return PostMFS100Client("match", jsonData);25}26// Function to make a call to the MFS client service to match the data.27function PostMFS100Client(method, jsonData) {28 var res;29 $.support.cors = true;30 var httpStatus = false;31 // Ajax request to match the fingerprint32 $.ajax({33 type: "POST",34 async: false,35 crossDomain: true,36 url: uri + method,37 contentType: "application/json; charset=utf-8",38 data: jsonData,39 dataType: "json",40 processData: false,41 success: function (data) {42 // Enters this if the request was answered, might not be a match still.43 httpStatus = true;44 res = { httpStatus: httpStatus, data: data };45 },46 error: function (jqXHR, ajaxOptions, thrownError) {47 // If the Ajax request fails, it enters this code.48 console.log("Ajaxops:" + ajaxOptions + " errthrown : " + thrownError);49 res = { httpStatus: httpStatus, err: getHttpError(jqXHR) };50 },51 });52 return res;53}54// If the Ajax request isn't successful, this defines what type of error occured.55function getHttpError(jqXHR) {56 var err = "Unhandled Exception";57 if (jqXHR.status === 0) {58 err = "Service Unavailable";59 } else if (jqXHR.status == 404) {60 err = "Requested page not found";61 } else if (jqXHR.status == 500) {62 err = "Internal Server Error";63 } else if (thrownError === "parsererror") {64 err = "Requested JSON parse failed";65 } else if (thrownError === "timeout") {66 err = "Time out error";67 } else if (thrownError === "abort") {68 err = "Ajax request aborted";69 } else {70 err = "Unhandled Error";71 }72 return err;73}74// GET request to '/authentication' is handled here.75router.get("/authentication", (req, res) => {76 var userdata = req.session.context; // Context is passed from index.js which contains relevant user info.77 if (userdata) {78 if (userdata.fingerprint) {79 // If the user has a registered fingerprint, the page is rendered with a fingerprint option.80 res.render("authentication", {81 name: userdata.name,82 fingerprint: true,83 result: "",84 redirectOptions: false,85 });86 } else {87 // If the user has no fingerprint, no option for fingerpint is shown.88 res.render("authentication", {89 name: userdata.name,90 fingerprint: false,91 result: "",92 redirectOptions: false,93 });94 }95 } else {96 res.status(401).render("401");97 }98});99// POST request to '/authentication' is handled here.100router.post("/authentication", (req, res) => {101 console.log(req.body);102 var userdata = req.session.context;103 if (userdata) {104 try {105 if (req.body.pin) {106 if (req.body.pin == userdata.pin) {107 res.render("authentication", {108 name: userdata.name,109 result: "Authenticated PIN successfully",110 fingerprint: userdata.fingerprint ? true : false,111 redirectOptions: true,112 });113 } else {114 res.render("authentication", {115 //If the PINs aren't a match, it displays the message.116 name: userdata.name,117 result: "Failed to authenticate PIN",118 fingerprint: userdata.fingerprint ? true : false,119 redirectOptions: false,120 });121 }122 } else {123 var isoTemplate = userdata.fingerprint;124 var resu = MatchFinger(100, 10, isoTemplate); // Calling the MatchFinger function to compare the stored FP data to captured FP data.125 if (resu.httpStatus) {126 // If the request was successful, enters this condition.127 if (resu.data.Status) {128 //If both the FPs were a match, enters this condition.129 res.render("authentication", {130 name: userdata.name,131 result: "Authenticated successfully",132 fingerprint: true,133 redirectOptions: true,134 });135 } else {136 if (resu.data.ErrorCode != "0") {137 //If there is an error in the FP data, the error code is displayed.138 console.log("Error Description : ", resu.data.ErrorDescription);139 if (resu.data.ErrorDescription === "Timeout") {140 res.render("authentication", {141 //If the FPs aren't a match, it displays the message.142 name: userdata.name,143 result: "Timed out waiting for fingerprint to be scanned.",144 fingerprint: true,145 redirectOptions: false,146 });147 }148 } else {149 res.render("authentication", {150 //If the FPs aren't a match, it displays the message.151 name: userdata.name,152 result: "Failed to authenticate",153 fingerprint: true,154 redirectOptions: false,155 });156 }157 }158 } else {159 // If the Ajax request was not successful, it shows what went wrong.160 console.log("RESU.ERR : ", resu.err);161 console.log("RESU : ", resu);162 }163 }164 } catch (error) {165 console.log("ERROR : ", error);166 res.render("authentication", {167 //If the PINs aren't a match, it displays the message.168 name: userdata.name,169 result: "There was an error with the server while authenticating.",170 fingerprint: userdata.fingerprint ? true : false,171 redirectOptions: false,172 });173 console.log("RENDER FINISHED");174 }175 } else {176 res.status(401).render("401");177 }178});...

Full Screen

Full Screen

en-cg.js

Source:en-cg.js Github

copy

Full Screen

1export default {2 devPeople: {3 title: {4 list: 'devPeople',5 select: 'devPeopleSelect',6 record: 'devPeople',7 groupDevPeopleRealName: 'groupDevPeopleRealName',8 groupDevPeopleCardNo: 'groupDevPeopleCardNo',9 sample: 'devVeinSample',10 code: 'DevPeople'11 },12 action: {13 getRegistered: 'GetRegistered',14 syncRegFingersConfirm: 'Confirm SyncRegFingers',15 syncRegFingers: 'SyncRegFingers',16 sample: 'Sample',17 connectDevice: 'ConnectDevice',18 registerFinger: 'RegisterFinger',19 verifyFinger: 'VerifyFinger',20 matchFinger: 'MatchFinger',21 removeFingerConfirm: 'Confirm RemoveFinger',22 removeFinger: 'RemoveFinger',23 resetDevice: 'ResetDevice'24 },25 route: {26 listTag: 'devPeople',27 selectTag: 'devPeopleSelect',28 recordTag: 'devPeople',29 sampleTag: 'devVeinSample'30 },31 field: {32 userNoValid: 'Please input correct value for userNo',33 userNo: 'UserNo',34 realName: 'RealName',35 sex: 'Sex',36 birthDate: 'BirthDate',37 orgCode: 'OrgCode',38 dutyRank: 'DutyRank',39 cardNoValid: 'Please input correct value for cardNo',40 cardNo: 'CardNo',41 idType: 'IdType',42 idNumber: 'IdNumber',43 userType_0: '管理员',44 userType_1: '普通人员',45 userType: 'UserType',46 mobilePhone: 'MobilePhone',47 email: 'Email',48 registerType: 'RegisterType',49 validDate: 'ValidDate',50 expiredDate: 'ExpiredDate',51 regTime: 'RegTime',52 devPassword: 'DevPassword',53 regFingers: 'RegFingers',54 note: 'Note',55 idNation: 'IdNation',56 photo: 'Photo',57 homeAddr: 'HomeAddr',58 fingerNo1: 'FingerNo1',59 fingerNo2: 'FingerNo2',60 fingerType_0: '右食指',61 fingerType_1: '右中指',62 fingerType_2: '右无名指',63 fingerType_3: '左食指',64 fingerType_4: '左中指',65 fingerType_5: '左无名指',66 fingerType_6: '自定义1',67 fingerType_7: '自定义2',68 fingerType: 'FingerType',69 warning: 'Warning'70 }71 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('./root');2var finger = "middle";3if(root.matchFinger(finger))4{5 console.log("Finger is matched");6}7{8 console.log("Finger is not matched");9}

Full Screen

Using AI Code Generation

copy

Full Screen

1const root = require('./root')2const {matchFinger} = root3matchFinger('left')4const matchFinger = require('./matchFinger')5module.exports = {6}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful