<? global $vis_language; 
$security_password=($security_password_details != -1) ? $security_password_details[0]['content'] : 50;?>
<script>
	$(document).ready(function(){
		function change_password_strength(strengthPercentage, is_valid){
			$("#password_strength_per").val(strengthPercentage);
			$("#password_strength_show").show();
			var show_password_result;
				if(strengthPercentage>=0 && strengthPercentage<50){show_password_result='<span class="label vh-yellow-bg"> <?=$vis_language['TXTWEAK'];?> </span>';}
				else if(strengthPercentage>=50 && strengthPercentage<70){show_password_result='<span class="label vh-green-bg"> <?=$vis_language['TXTMEDIUM'];?> </span>';}
				else if(strengthPercentage>=70 && strengthPercentage<90){show_password_result='<span class="label vh-orange-bg"> <?=$vis_language['TXTSTRONG'];?> </span>';}
				else if(strengthPercentage>=90 && strengthPercentage<=100){show_password_result='<span class="label vh-red-bg"> <?=$vis_language['TXTVERYSTRONG'];?> </span>';}
				if(is_valid=='not_allowed') $('#password_strenght_id').html('<? echo $vis_language['TXTPASSWORDSRENGTH']."&nbsp;&nbsp;"; ?> '+show_password_result+ '&nbsp;&nbsp; <?=$vis_language['TXTNOTALLOWED']?>');
				else if(is_valid=='allowed') $('#password_strenght_id').html('<? echo $vis_language['TXTPASSWORDSRENGTH']."&nbsp;&nbsp;"; ?> '+show_password_result+ '&nbsp;&nbsp; <?=$vis_language['TXTALLOWED']?>');
				return true;	
		}
		
		$('#vis_newpassword').pStrength({
			'changeBackground'          : false,
			'onPasswordStrengthChanged' : function(passwordStrength, strengthPercentage) {
				if(passwordStrength!=0){change_password_strength(strengthPercentage,'not_allowed');}
			},
			'passwordValidFrom': <?=$security_password?>,
			'onValidatePassword': function(strengthPercentage) {
				change_password_strength(strengthPercentage,'allowed');
			}
		});
	});

/*  disable scacebar  */
	$(function() {
         var txt = $("input#vis_newpassword");
         var func = function() {
             txt.val(txt.val().replace(/\s/g, ''));
    }
    txt.keyup(func).blur(func);
});
</script>
 <section class="container m-t-md">
   <div class="row">
      <div class="col-md-12">
          <section class="panel shadow-none">
          <header class="vis_login_head">
				<? if(isset($operation['message']) && $operation['message']!='') { 
                    if($operation['success']!=1){?>
                <script> $("#vis_submit_err_div").show(); $("#vis_submit_err_div").html('<? echo $operation['message']; ?>'); </script><? }
                    else{?>  <script> $("#vis_submit_msg_div").show(); $("#vis_submit_msg_div").html('<? echo $operation['message']; ?>'); </script> <?}
                    }  ?>
			</header>
		
		<div class="panel-body">
		  <section id="content" class="wrapper-md animated fadeInUp">   
			<div class="container aside-xl">
			  <section class="m-b-lg">
				<form action="index.php" name="vis_form_password" id="vis_form_password" method="post">
                    <div class="list-group">
                        <div class="login-list-group-item">
                            <input type="password" placeholder="New password" name="vis_newpassword"  id="vis_newpassword" data-display="password_strenght_id" data-type="text" class="form-control no-border">
                        </div>
                    </div>
                    <div class="list-group" style="display:none" id="password_strength_show">
                        <div>
                             <input type="hidden" name="password_strength_per" id="password_strength_per" value='0'>
                           <div id="password_strenght_id" class="checkbox-inline"></div>
                        </div>
                     </div>
                    <div class="list-group">
                        <div class="login-list-group-item">
                            <input type="password" placeholder="Confirm password" name="vis_confirm" id="vis_confirm" data-type="text" class="form-control no-border">
                        </div>
                    </div>
				  <div class="list-group">
					<div >
					  <button type="submit" class="btn btn-lg btn-primary btn-block"><? echo $vis_language['TXTUPDATEPASSWORD']; ?></button>
					  <input type="hidden" name="vis_operation" value="set_forgetpassword" /><input type="hidden" name="vis_module" value="client" />
                      <input type="hidden" name="vis_email" id="vis_email" value="<?= $client_email; ?>" />
                      <input type="hidden" name="vis_passwd_auth" id="vis_passwd_auth" value="<?= $passwd_auth; ?>" />
					</div>
				  </div>
                    <div class="list-group">
                        <div class="text-center">
                            <a href="index.php?/home/login" class="link"><? echo $vis_language['TXTBACKTOLOGIN']; ?></a>
                        </div>
                    </div>
				</form>
			  </section>
			</div>
		  </section>
		</div>
	     </section>
      </div>
   </div>
</section>
