<?php 

include('libraryPHP/site_config.php');



//include('libraryPHP/session_check_url.php');



?>




<!DOCTYPE html>

<html lang="en">

    <head>

        <meta charset="utf-8">

        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
 <title><?php echo $appName?> | <?php echo $pageTitle?></title>



    <!-- Favicon -->

      <?php echo $appFaviconHtml;?>



		<!-- Bootstrap CSS -->

        <link rel="stylesheet" href="assets/css/bootstrap.min.css">

		

		
    <link rel="stylesheet" href="assets/css/font-awesome.min.css">



    <!-- Main CSS -->

    <link rel="stylesheet" href="assets/css/style.css">

    <!-- My Custom -->

    <link rel="stylesheet" href="custom.css">

    <!-- font awesome -->

    <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" />





    <style>

        .eye {

            position: absolute;

            right: 28%;

            transform: translate(0, -176%);

            top: auto;

            cursor: pointer;

        }



        #togglePassword1 {

            position: absolute;

           /* right: 52%;*/

            transform: translate(0, -176%);

            top: auto;

            cursor: pointer;

        }



        #togglePassword2 {

            position: absolute;

           /* right: 154%;
*/
            transform: translate(0, -174%);

            top: auto;

            cursor: pointer;

        }

          #togglePassword12 {

            position: absolute;

         /*   right: 52%;*/

            transform: translate(0, -176%);

            top: auto;

            cursor: pointer;

        }



        #togglePassword22 {

            position: absolute;

        /*    right: 154%;*/

            transform: translate(0, -174%);

            top: auto;

            cursor: pointer;

        }
        .error{
            color:red;
        }

    </style>




    </head>

    <body>

	

		<!-- Main Wrapper -->

        <div class="main-wrapper login-body">

            <div class="login-wrapper">

            	<div class="container">

                	<div class="loginbox">

                    	<div class="login-left">

							<img class="img-fluid" src="assets/images/logo1.png" alt="Logo">

                        </div>

                        <div class="login-right">

							<div class="login-right-wrap">

								<h1>Reset Password?</h1>

								<p class="account-subtitle"></p>

								

								<!-- Form -->
  <form action="" method="post" id="form_validation_reset_admin">

              
      <input required="required" type="hidden" id="action" name="action" value="reset_password_admin">

       <input type="hidden" name="uniqcode" value="<?=$_GET['uniqcode']?>">

									
                         <div class="form-group">

                                    <input class="form-control" type="password" name="password" id="password1" placeholder="Enter New Password" maxlength="16">

                                    <span class="eye" onclick="myfunction1()">

                                        <i class="fa fa-eye-slash" id="togglePassword1"></i>

                                        <i class="fa fa-eye " id="togglePassword2" style="display:none;"></i>

                                    </span>

                                </div>

                                 <div class="form-group">

                                    <input class="form-control" type="password" name="cpassword" id="password12" placeholder="Enter Confirm Password" maxlength="16">

                                    <span class="eye" onclick="myfunction12()">

                                        <i class="fa fa-eye-slash" id="togglePassword12"></i>

                                        <i class="fa fa-eye " id="togglePassword22" style="display:none;"></i>

                                    </span>

                                </div>
									<div class="form-group mb-0">

										<button class="btn btn-primary w-100" type="submit">Reset Password</button>

									</div>

								</form>

								<!-- /Form -->

								

								<div class="text-center dont-have"><a href="index.php" class="auth-link ">Back?Login</a></div>

							</div>

                        </div>

                    </div>

                </div>

            </div>

        </div>

		<!-- /Main Wrapper -->

		

		<!-- jQuery -->
	
    <?php include('commonjs.php')?>

    <!-- extra js -->

         <?php include_once('extrajs.php') ?>









       

      



        <script>

            

            $( document ).ready(function() {

  // Initialize form validation on the registration form.

  //---------------------- start for validations ---------------------

  $("#form_validation_reset_admin").validate({

    rules: {

     password: {

        required: true,

         minlength:6,

         maxlength: 15,

      },

      cpassword: {

        required: true,

         minlength:6,

         maxlength: 15,

         equalTo: "#password1"

      },

    },

    messages: {

      password: {

       required: msgValidation.emptyNewPassword[language],

        minlength: msgValidation.validMinlengthpass[language],

        maxlength: msgValidation.validMaxlengthpass[language],

     },

     cpassword: {

       required: msgValidation.emptyConfirmPassword[language],

        minlength: msgValidation.validMinlengthpass[language],

        maxlength: msgValidation.validMaxlengthpass[language],

        equalTo: msgValidation.validEqualConfirm[language],

     },

    },

    submitHandler: function(form) {

      //form.submit();



        var link = URLAPI+'auth.php';

        var data=$(form).serialize();



        var messsage = msgLoading.blankMessage[language];

        consoleProvider.log('messsage',messsage);

        

        apiRequest.post(link, data, messsage).then(function(obj){

          consoleProvider.log('obj',obj);

          if(obj.success === true) {  

              var title = msgTitleOperation.resetStatus[language];

              var messsage = obj.msg[language];

              swal({

                title: title,

                text: messsage,

                icon: "success", //error, success, info

                button: "Ok",

              }).then((value) => {

                window.location.href="index.php";

              });;

              return false;  

          } else {

              //alert(obj.msg);

              var title = msgTitleOperation.resetStatus[language];

              var messsage = obj.msg[language];

              swal({

                title: title,

                text: messsage,

                icon: "error", //error, success, info

                button: "Ok",

              });

              return false;

          }

        },function(err){

          consoleProvider.log('err',err);

          var title = msgTitleOperation.errorOnServer[language];

          var messsage = msgOperations.errorOnServer[language];

          swal({

            title: title,

            text: messsage,

            icon: "warning", //error, success, info

            button: "Ok",

          });



        });

    }

  });

  //---------------------- start for validations end ---------------------

});

        </script>




    </script>

     <script>

        function myfunction1() {

            var x = document.getElementById("password1");

            var y = document.getElementById("togglePassword1");

            var z = document.getElementById("togglePassword2");



            if (x.type === 'password') {

                x.type = "text";

                y.style.display = "none";

                z.style.display = "block";

            } else {

                x.type = "password";

                y.style.display = "block";

                z.style.display = "none";

            }

        }



          function myfunction12() {

            var x = document.getElementById("password12");

            var y = document.getElementById("togglePassword12");

            var z = document.getElementById("togglePassword22");



            if (x.type === 'password') {

                x.type = "text";

                y.style.display = "none";

                z.style.display = "block";

            } else {

                x.type = "password";

                y.style.display = "block";

                z.style.display = "none";

            }

        }

    </script>


		

    </body>

</html>