Plugin Directory

Changeset 3245679


Ignore:
Timestamp:
02/24/2025 11:25:27 AM (12 months ago)
Author:
newwaypmsco
Message:

Updated to version 1.0.4: Added image quality checks and user guidance.

Location:
facial-recognition-authentication/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • facial-recognition-authentication/trunk/assets/js/main.js

    r3245333 r3245679  
    2424            });
    2525            Webcam.attach('#my_camera');
     26            // اضافه کردن راهنما
     27            $('#camera-guide').html('<p>Please position your face close to the camera so it fills most of the frame.</p>');
    2628        });
    2729
     
    7779        const email = $('#email').val();
    7880        const password = $('#password').val();
    79         const domain = pluginData.domain;  // تغییر از site_id به domain
     81        const domain = pluginData.domain;
    8082
    8183        const file = get_file_from_base64(base64image, `${email}.jpg`);
    82 
    83 
    8484        const url = "https://api.newwaypmsco.com/api/user/register/";
    8585        const payload = new FormData();
     
    9494        })
    9595            .then(response => {
    96                 if (response.ok) {
    97                     swal({
    98                         title: 'Success',
    99                         text: 'Register success',
    100                         icon: 'success',
    101                         buttons: false,
    102                         timer: 2000
    103                     });
    104                 } else {
    105                     swal({
    106                         title: 'Error',
    107                         text: 'Something went wrong',
    108                         icon: 'error'
     96                if (!response.ok) {
     97                    return response.json().then(data => {
     98                        if (data.avatar) {
     99                            swal({
     100                                title: 'Image Error',
     101                                text: data.avatar[0],
     102                                icon: 'error'
     103                            });
     104                        } else if (data.email) {
     105                            swal({
     106                                title: 'Email Error',
     107                                text: data.email[0],
     108                                icon: 'error'
     109                            });
     110                        } else if (data.domain) {
     111                            swal({
     112                                title: 'Domain Error',
     113                                text: data.domain[0],
     114                                icon: 'error'
     115                            });
     116                        } else {
     117                            swal({
     118                                title: 'Error',
     119                                text: 'Something went wrong during registration.',
     120                                icon: 'error'
     121                            });
     122                        }
     123                        throw new Error('Registration failed');
    109124                    });
    110125                }
     126                return response.json();
     127            })
     128            .then(data => {
     129                swal({
     130                    title: 'Success',
     131                    text: 'Registration successful!',
     132                    icon: 'success',
     133                    buttons: false,
     134                    timer: 2000
     135                });
     136            })
     137            .catch(error => {
     138                console.error('Error:', error);
    111139            });
    112140    }
  • facial-recognition-authentication/trunk/assets/js/main2.js

    r3245333 r3245679  
    2626            });
    2727            Webcam.attach('#my_camera');
     28            // اضافه کردن راهنما
     29            $('#camera-guide').html('<p>Please position your face close to the camera so it fills most of the frame.</p>');
    2830        });
    2931
     
    9597        console.log("Payload ready to send");
    9698
     99
    97100        fetch("https://api.newwaypmsco.com/api/user/login/", {
    98101            method: 'POST',
     
    101104            .then(response => {
    102105                console.log("Response status:", response.status);
    103                 if (response.ok) {
     106                if (!response.ok) {
     107                    return response.json().then(data => {
     108                        if (data.avatar2) {
     109                            swal({
     110                                title: 'Image Error',
     111                                text: data.avatar2[0],
     112                                icon: 'error'
     113                            });
     114                        } else if (data.message === 'Invalid Login Details!') {
     115                            swal({
     116                                title: 'Login Error',
     117                                text: 'Incorrect email or password.',
     118                                icon: 'error'
     119                            });
     120                        } else if (data.message === 'Domain mismatch') {
     121                            swal({
     122                                title: 'Domain Error',
     123                                text: 'This user is not registered for this domain.',
     124                                icon: 'error'
     125                            });
     126                        } else if (data.message === 'Face Not Recognized') {
     127                            swal({
     128                                title: 'Recognition Error',
     129                                text: 'Your face was not recognized. Please try again.',
     130                                icon: 'error'
     131                            });
     132                        } else {
     133                            swal({
     134                                title: 'Error',
     135                                text: 'Something went wrong during login.',
     136                                icon: 'error'
     137                            });
     138                        }
     139                        throw new Error('Login failed');
     140                    });
     141                }
     142                return response.json();
     143            })
     144            .then(data => {
     145                if (data.success === 'True') {
    104146                    swal({
    105147                        title: 'Success',
    106                         text: 'Login successful',
     148                        text: 'Login successful!',
    107149                        icon: 'success',
    108150                        timer: 2000
    109151                    }).then(() => refresh_page());
    110                 } else {
    111                     response.text().then(text => {
    112                         console.log("Login error response:", text);
    113                         swal({
    114                             title: 'Error',
    115                             text: 'Something went wrong: ' + text,
    116                             icon: 'error'
    117                         });
    118                     });
    119152                }
    120153            })
  • facial-recognition-authentication/trunk/facial-recognition-authentication.php

    r3245333 r3245679  
    1414Description: Face ID registration and login for WordPress
    1515Author: New-way
    16 Version: 1.0.3
     16Version: 1.0.4
    1717*/
    1818
  • facial-recognition-authentication/trunk/inc/admin_menu_page.php

    r3242754 r3245679  
    33?>
    44
    5 <div class="wrap">
    6     <section class="bg-dark">
     5    <div class="wrap">
    76        <div class="container-fluid">
    8             <div class="row text-center align-items-center justify-content-center" style="height: 100vh;">
     7            <!-- Grid Bootstrap -->
     8            <div class="row text-center align-items-center justify-content-center"
     9                 style="height: 100vh; background-color: #343a40;">
    910                <div class="col-sm-12 col-md-6 mx-auto">
    1011                    <h1 class="text-white mb-5">
    11                         FaceRecognition authentication plugin for WordPress websites
     12                        FaceRecognition Authentication Plugin for WordPress Websites
    1213                    </h1>
     14                    <!-- Capture Photo -->
    1315                    <button class="btn btn-warning text-white" id="accesscamera" data-bs-toggle="modal"
    1416                            data-bs-target="#photoModal">
     
    1820            </div>
    1921        </div>
    20     </section>
    2122
    22     <!-- Modal -->
    23     <div class="modal fade" id="photoModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    24         <div class="modal-dialog">
    25             <div class="modal-content">
    26                 <div class="modal-header">
    27                     <h5 class="modal-title" id="exampleModalLabel">Capture Photo</h5>
    28                     <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    29                 </div>
    30                 <div class="modal-body">
    31                     <div id="my_camera" class="d-block mx-auto rounded overflow-hidden"></div>
    32                     <div id="results" class="d-none"></div>
    33                     <form method="post" id="photoForm" enctype="multipart/form-data">
    34                         <input type="hidden" id="photoStore" name="photoStore" value="">
    35                     </form>
    36                 </div>
    37                 <div class="modal-footer">
    38                     <button type="button" class="btn btn-warning mx-auto text-white" id="takephoto" form="photoForm">
    39                         Capture Photo
    40                     </button>
    41                     <button type="button" class="btn btn-warning mx-auto text-white d-none" id="retakephoto">Retake
    42                     </button>
    43                     <button type="submit" class="btn btn-warning mx-auto text-white d-none" id="uploadphoto"
    44                             form="photoForm">Upload
    45                     </button>
    46                     <input type="email" name="email" form="photoForm" id="email" class="d-none" value=""
    47                            placeholder="Email" required/>
    48                     <input type="password" name="password" form="photoForm" id="password" class="d-none" value=""
    49                            placeholder="Enter your password" required/>
    50                     <div id="alert"></div>
     23        <!-- Modal Capture Photo -->
     24        <div class="modal fade" id="photoModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
     25            <div class="modal-dialog">
     26                <div class="modal-content">
     27                    <div class="modal-header">
     28                        <h5 class="modal-title" id="exampleModalLabel">Capture Photo</h5>
     29                        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
     30                    </div>
     31                    <div class="modal-body">
     32                        <div id="my_camera" class="d-block mx-auto rounded overflow-hidden"></div>
     33                        <div id="camera-guide" style="text-align: center; color: #333; margin-top: 10px;"></div>
     34                        <div id="results" class="d-none"></div>
     35                        <form method="post" id="photoForm">
     36                            <input type="hidden" id="photoStore" name="photoStore" value="">
     37                        </form>
     38                    </div>
     39                    <div class="modal-footer">
     40                        <button type="button" class="btn btn-warning mx-auto text-white" id="takephoto" form="photoForm">
     41                            Capture Photo
     42                        </button>
     43                        <button type="button" class="btn btn-warning mx-auto text-white d-none" id="retakephoto">
     44                            Retake
     45                        </button>
     46                        <button type="submit" class="btn btn-warning mx-auto text-white d-none" id="uploadphoto"
     47                                form="photoForm">
     48                            Upload
     49                        </button>
     50                        <input type="email" name="email" form="photoForm" id="email" class="d-none" value=""
     51                               placeholder="Email" required/>
     52                        <input type="password" name="password" form="photoForm" id="password" class="d-none" value=""
     53                               placeholder="Enter your password" required/>
     54                        <div id="alert"></div>
     55                    </div>
    5156                </div>
    5257            </div>
    5358        </div>
    5459    </div>
    55 </div>
    5660
    5761<?php wp_footer(); ?>
  • facial-recognition-authentication/trunk/inc/admin_menu_page2.php

    r3242754 r3245679  
    44
    55    <div class="wrap">
    6         <div class="container-fluid">
    7             <!--  grid bootstrap -->
    8             <div class="row text-center align-items-center justify-content-center"
    9                  style="height: 100vh; background-color: #343a40;">
    10                 <div class="col-sm-12 col-md-6 mx-auto">
    11                     <h1 class="text-white mb-5">
    12                         FaceRecognition Authentication Plugin for WordPress Websites
    13                     </h1>
    14                     <!--  Capture Photo -->
    15                     <button class="btn btn-warning text-white" id="accesscamera" data-bs-toggle="modal"
    16                             data-bs-target="#photoModal">
    17                         Capture Photo
    18                     </button>
     6        <section class="bg-dark">
     7            <div class="container-fluid">
     8                <div class="row text-center align-items-center justify-content-center" style="height: 100vh;">
     9                    <div class="col-sm-12 col-md-6 mx-auto">
     10                        <h1 class="text-white mb-5">
     11                            FaceRecognition Authentication Plugin for WordPress Websites
     12                        </h1>
     13                        <button class="btn btn-warning text-white" id="accesscamera" data-bs-toggle="modal"
     14                                data-bs-target="#photoModal">
     15                            Capture Photo
     16                        </button>
     17                    </div>
    1918                </div>
    2019            </div>
    21         </div>
     20        </section>
    2221
    23         <!-- Modal Capture Photo -->
     22        <!-- Modal -->
    2423        <div class="modal fade" id="photoModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    2524            <div class="modal-dialog">
     
    3029                    </div>
    3130                    <div class="modal-body">
    32 
    3331                        <div id="my_camera" class="d-block mx-auto rounded overflow-hidden"></div>
    34 
     32                        <div id="camera-guide" style="text-align: center; color: #333; margin-top: 10px;"></div>
    3533                        <div id="results" class="d-none"></div>
    36                         <form method="post" id="photoForm">
     34                        <form method="post" id="photoForm" enctype="multipart/form-data">
    3735                            <input type="hidden" id="photoStore" name="photoStore" value="">
    3836                        </form>
    3937                    </div>
    4038                    <div class="modal-footer">
    41 
    42                         <button type="button" class="btn btn-warning mx-auto text-white" id="takephoto"
    43                                 form="photoForm">Capture Photo
     39                        <button type="button" class="btn btn-warning mx-auto text-white" id="takephoto" form="photoForm">
     40                            Capture Photo
    4441                        </button>
    4542                        <button type="button" class="btn btn-warning mx-auto text-white d-none" id="retakephoto">
     
    4744                        </button>
    4845                        <button type="submit" class="btn btn-warning mx-auto text-white d-none" id="uploadphoto"
    49                                 form="photoForm">Upload
     46                                form="photoForm">
     47                            Upload
    5048                        </button>
    51 
    5249                        <input type="email" name="email" form="photoForm" id="email" class="d-none" value=""
    5350                               placeholder="Email" required/>
  • facial-recognition-authentication/trunk/readme.txt

    r3245333 r3245679  
    55Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 1.0.3
     7Stable tag: 1.0.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    8181== Changelog ==
    8282
     83= 1.0.3 - 2025-02-24 =
     84* Added image quality checks for registration and login (face detection, clarity, and size).
     85* Improved user guidance for capturing clear, close-up photos.
     86
    8387= 1.0.3 - 2025-02-23 =
    8488* Fixed login issue where FormData was not sending correctly, ensuring proper authentication with domain validation.
     
    98102
    99103== Upgrade Notice ==
     104
     105= 1.0.4 =
     106This update ensures better photo quality for accurate facial recognition. Update for improved security.
    100107
    101108= 1.0.3 =
Note: See TracChangeset for help on using the changeset viewer.