
<script src="https://www.google.com/recaptcha/api.js"></script>
<script type="text/javascript" src="./vista/lib/js/jquery-3.4.1.min.js"></script>
<div class="hold-transition login-page" style="background-image: url(vista/lib/dist/img/img_sgi.jpg); background-repeat: no-repeat;">
  <div class="login-box">
      
    <!-- /.login-logo -->
    <div class="card">
      <div class="card-body login-card-body">
        <!-- <p class="login-box-msg">Iniciar sesión</p> -->
        <div class="text-center">
          <a href="#" class="">
            <img src="./vista/lib/dist/img/logo_sgi.png" style="height: 150px; text-align: center;">
          </a>
        </div>
        <form action="" method="post" id="frm_login">
          <div class="input-group mb-3">
            <input type="email" class="form-control" id="username" name="username" placeholder="Usuario" required="">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-envelope"></span>
              </div>
            </div>
          </div>
          <div class="input-group mb-3">
            <input type="password" class="form-control" id="password" name="password" placeholder="Contraseña" required="">
            <div class="input-group-append">
              <div class="input-group-text">
                <span class="fas fa-lock"></span>
              </div>
            </div>
          </div>
          <div class="g-recaptcha container-fluid" data-sitekey="6LenyGkaAAAAAAFkMhB_Ko5_HQG3TmFZ25dFkmqT"></div>
          <div class="row">
            <div class="col-sm-12 mt-3">
              <button type="submit" class="btn btn-success btn-block">Iniciar sesión</button>
            </div>
            <!-- /.col -->
          </div>
          <br>
          <div id="msj">
            
          </div>
          <?php 
            if(isset($_POST['username']) && isset($_POST['password'])){
              
              $captcha = $_POST['g-recaptcha-response'];
              $secret  = '6LenyGkaAAAAAOwKpiKssKsRkxWrIjMnNm6HsDCU';

              if(!$captcha){
                echo "<br><div class='alert alert-danger'>Por favor verifica el captcha</div>";
              }else{

                require_once "./controlador/administador.controlador.php";

                $controladorAdministrador = new ControladorAdministrador();
                
                echo $controladorAdministrador->ctrConsultaAdministrador();
                
              }
            }
           ?>
           
        </form>
        <p class="mb-1 mt-2 text-center">
          <a href="http://alejoposada.info/sie/vista/modulos/restablecerclave.php">¿Olvido su contraseña?_</a>
        </p>
      </div>
      <!-- /.login-card-body -->
    </div>
  </div>
</div>
<!-- 
<script type="text/javascript">
  $(document).ready(function(){
    
    $('#frm_login').on('submit', function(e){
      e.preventDefault();
      
      let usuario = $('#username').val();
      let clave   =$('#password').val();
      let captcha =$('#g-recaptcha-response').val();

      if(usuario == ""){

        $('#msj').html('<div class="alert alert-danger">Por favor ingresar un nombre de usuario.</div>');
      
      }else{
          
        if(clave == ""){

          $('#msj').html('<div class="alert alert-danger">Por favor ingresar una contraseña.</div>');

        }else{
          
          if(!captcha){

            $('#msj').html('<div class="alert alert-danger">Por favor verificar el captcha</div>');
          
          }else{
            
            $('#msj').html('');
          
          } 
        
        }  

      }

      // if(usuario != "" && clave !="" && captcha != ""){

      //   $.ajax({
      //     url: './try.php',
      //     type: 'POST',
      //     data: "username="+usuario+"&password="+clave+"&peticion_ajax="+true+"&accion=iniciar_sesion",
      //     success:function(data){

      //       $('#msj').html(data);
          
      //     }

      //   });

      // }

    });

  });
</script> -->
