当前位置:网站首页>54: Chapter 5: develop admin management services: 7: face warehousing process; Face login process; The browser turns on the video debugging mode (so that the camera can also be turned on in the case o

54: Chapter 5: develop admin management services: 7: face warehousing process; Face login process; The browser turns on the video debugging mode (so that the camera can also be turned on in the case o

2022-07-28 02:08:00 Small withered forest

explain :

(1) The content of this blog : Introduce the face warehousing process , Face login process ; Face warehousing process ;Chrome Turn on video debugging mode , So that in the case of the insecure domain name of this machine , You can also turn on the camera ;

Catalog

One : Face warehousing process , Face login process ;

Two :Chrome Turn on video debugging mode ;


One : Face warehousing process , Face login process ;

Before face login , First of all, face storage ;

(1) First , When creating an administrator account , Check " Face login ";

(2) Click on " Get face " after , It can capture the dynamic picture of human face in the picture , Get face data ;( Actually , What you get is a human face Base64 The data of )

(3) then , When adding a new administrator , It will judge whether there is face data ;

          ●  If there is no face , Will use the previous we in 【51: The fifth chapter : Development admin management service :4: Development 【 newly added admin account number , Interface 】;】 Logic written in ;

          ●  If there's a face , Need to do a face storage operation ( namely , Put the face Base64 data , Save to MongoDB Of GridFS in ); After saving it , You'll get FaceId; then ,FaceId Along with other information , To the back-end logic , To create a new administrator account ;

(4) After that , The administrator account we created this time , Then you can use your face to log in ;

(1) When the administrator logs in , To use face login ; You need to check " Login with face ";

(2) Click to log in , Will get face data ; And carry face data to the back end ( That is, the face captured at this time Base64 The data of , Take it to the back );

(3) then , A verification will be done on the back end : In fact, it is to use 【 stay (2) Face data captured in 】 and 【 Before, when the face was stored , Save in MongoDB Of GridFS Face data in 】 Compare and match ;

          ●  This match is a similarity match ; such as , We can set it in the background ; such as , We can set , As long as two faces are similar >=90%, Think of it as OK;

(4) If the face verification is successful , Direct login success ; If the check fails , You can return to the login page , Let users try again ;


Two :Chrome Turn on video debugging mode ;

(1) In the course , Using an older browser , The mistake it reported was :

……………………………………………………

(2) And my browser is the latest version ; I'm checking " Face login " when , What's wrong : 【TypeError: Cannot read properties of undefined (reading 'getUserMedia')】;

          ●  You can refer to 【 solve “TypeError: Cannot read properties of undefined (reading ‘xxx‘)“】;

          ●  The wrong logic should be :【 Because our domain name is right and wrong https Of , That is, unsafe 】→【 therefore , Front-end getUserMedia() This method cannot work 】→【 therefore , Call the camera , The logic of obtaining face avatars , Just G 了 】;

……………………………………………………

(3) Solutions :

          ●  Strategy 1: Set the local domain name , Change it to https;

          ●  Strategy 2: In Google browser 【chrome://flags/#unsafely-treat-insecure-origin-as-secure】 in , Set the following :

………………………………………………

(4) effect ;

          ●  Make sure you PC The camera is OK Of , And it's unlock The state of ;

          ●  In addition admin Administrator account , yes OK Of ;

          ●  stay admin The administrator logs in there , It's also OK Of ;

……………………………………………………

(5) Statement :

          ●  Every time we restart the computer , All in accordance with (3) Strategy in , Reset ;

          ●  In the production environment , When we deploy the project , The domain name of the project will be set to https; therefore , In the actual production environment , There is no problem here ;

原网站

版权声明
本文为[Small withered forest]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/209/202207280019556978.html