<div class="row">
	<form autocomplete='off' class='form-horizontal' name='formChangePass' id='formChangePass'  method='post' action='<?php echo base_url('administracion/actualizar_password');?>' onsubmit="usuarios.actualizarPass(event)">
		<div class="panel blank-panel">
			<div class="panel-body">
				<div class="form-group">
					<label class="control-label">Contrase&ntilde;a anterior:</label>
					<input type="hidden" id="id_usuario_change_pass" name="id_usuario_change_pass" value="<?php echo $usuario->id_usuario;?>">
					<input type="hidden" id="actual_password" name="" value="<?php echo $usuario->password_usuario;?>">
					<input type="password" class="form-control" id="actual_enter_password" required>
				</div>
				<div class="form-group">
					<label class="control-label">Nueva contrase&ntilde;a:</label>
					<input type="password" class="form-control" id="new_password" name="" required>
					<span id="" class="help-block m-b-none passEvaluate" style=""></span>
				</div>
				<div class="form-group">
					<label class="control-label">Confirmar contrase&ntilde;a:</label>
					<input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
				</div>
				<div class="form-group text-center">
					<button type="button" class="btn btn-danger btn-rounded" onclick="Custombox.close();">Cancelar</button>
					<button type="submit" class="btn btn-primary btn-rounded" id="actualizar-password">Guardar contrase&ntilde;a</button>
				</div>
			</div>
		</div>
	</form>
</div>
<script>
	$('#new_password').keyup(function(){
		if($('#new_password').val() != ""){
			$('.passEvaluate').text(checkStrength($('#new_password').val()));
		}else{
			$('.passEvaluate').text("");
		}		
	});

	function checkStrength(password){
        var strength = 0
        
        if(password.length < 6) {
            $('.passEvaluate').css('color','#FF0000');
            return 'Contraseña muy corta';
        }
        if(password.length > 7) {
            strength += 1
        }
        if(password.match(/([a-zA-Z])/) && password.match(/([0-9])/)) {
            strength += 1
        }
        if(password.match(/([!,%,&,@,#,$,^,*,?,_,~])/)) {
            strength += 1
        }
        if(password.match(/(.*[!,%,&,@,#,$,^,*,?,_,~].*[!,%,&,@,#,$,^,*,?,_,~])/)) {
            strength += 1
        }
        
        if(strength < 2) {
            $('.passEvaluate').css('color','#FF0000');
            return 'Contraseña muy débil';
        }else if(strength == 2){
            $('.passEvaluate').css('color','#0866C6');
            return 'Contraseña muy buena';
        }else{
            $('.passEvaluate').css('color','#008000');
            return 'Contraseña excelente';
        }
    }
</script>