 <?php  
                                  $user_key=$_GET['user_key'];
                                    $user_key;
                                  $sess = \Session::get('id');?>

<!DOCTYPE html>
<html lang="en">
   <head>
      <script src="<?php echo e(asset('assets/js/jquery.js')); ?>"></script>
   </head>
   <body>
      <div class="wrapper_main">
         <div class="nav_main">
          <?php echo $__env->make('include.frontpage_headers', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
         </div>
		 <?php
		 if($user_key)
		 {
		 ?>
         <div class="section2">
            <div class="container">
               <div class="row">
                  <div class="minheight-section">
                     <div class="col-md-12">
					 <!--setting_main_psw-->
                        <div class="">
						<div class="resetpwd-section">
                           <meta name="_token" content="<?php echo csrf_token(); ?>"/>
                           <div class="tab-pane" id="changepass">
                              <h2 class="head2"> Change Password </h2>
                              <p class="para9"> Your password must have a minimum of 4characters. </p>
                             
                              <form role="form"  id="psw_chng" >
                                 <input type="hidden" name="user_key" value="<?php echo $user_key;?>">
                                 <input type="password" placeholder="Enter New Password" name="newpassword"  class="settingfield1 frgtpwd-field" required><br>
                                 <input type="password" placeholder="Confirm Password" name="confirmpassword" class="settingfield1 frgtpwd-field" required>
                                 <div style=" width:100%;">
                                    <input class="stngbtn_sv login-maain-btn" type="submit" value="SAVE">
                                    <!-- <div class="stngbtn_sv"> SAVE </div>-->
                              </form>
                              </div>
                           </div>
						   </div>
                        </div>
                        <div class="msg"> </div>
                     </div>
                  </div>
               </div>
            </div>
         </div>
		 <?php
		  }
		 ?>
         <?php echo $__env->make('include.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
      </div>
      <script src="<?php echo e(asset('assets/js/jquery.js')); ?>"></script>
      <script src="<?php echo e(asset('assets/js/jquery.validate.min.js')); ?>"></script>
      <script type="text/javascript">
         $(document).ready(function(){
         	$('#psw_chng').validate({
         				rules: {
         					newpassword: {
         				
         				minlength:4
         				
         				},
         				 
         				confirmpassword: {
         			 
         				minlength:4
         				
         				},
						
         			
                 },
         								
                 highlight: function(element) {
                     $(element).addClass('red');
                 },
                 unhighlight: function(element) {
                     $(element).removeClass('red');
                 },
         		submitHandler: function(form) {
         			/*ajax start here*/
         				 
         							var value =$("#psw_chng").serialize() ;
         							//alert(value);
						 
         							$.ajax({
         								   url: "<?php echo e(url('user/change-pswd')); ?>",
         								   method:'get',
         								   data:value,
         								   success:function(chng_pwd){
         									   
         									   if(chng_pwd=='1')
         									   {
												  alert('Succesfully Changed Your Password');
         										
												 window.location="<?php echo e(url('/')); ?>"; 
         									   }
         									   else if(chng_pwd=='2')
         									   {
         										   
         										   $(".msg").html('<div class="alert alert-danger">password not matching</div>');
         										  
         									   }
											   else
											   {
												    $(".msg").html('<div class="alert alert-danger">error</div>');
											   }
         										 	}
         									 });
					 
                   /*ajax end here*/
         		   
                 }
         		
         							
         	});					   
         });
         	$.ajaxSetup({
            headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
         });
      </script>

