<?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">

		

		<!-- Fontawesome 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">

		

		<!--[if lt IE 9]>

			<script src="assets/js/html5shiv.min.js"></script>

			<script src="assets/js/respond.min.js"></script>

		<![endif]-->



    </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>Forgot Password?</h1>

								<p class="account-subtitle">Enter your email to get a password reset link</p>

								

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



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

									<div class="form-group">

										<input class="form-control" type="text" placeholder="Email" name="email">

									</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')?>

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





        <script type="text/javascript">



    $( document ).ready(function() {



      // Initialize form validation on the registration form.



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



      $("#form_validation_forgot").validate({



        rules: {



          email: {



            required: true,



            // minlength: 3,



            maxlength: 50,



            email: true



          },



        },



        messages: {



          email: {



            required: msgValidation.emptyEmail[language],



            // minlength: msgValidation.validMinLength[language],



            maxlength: msgValidation.validMaxLength[language],



            email: msgValidation.validEmail[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.forgotStatus[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.forgotStatus[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>

		

    </body>

</html>