<?php include_once "./Configs.php"; ?>
<!DOCTYPE html>
<html lang="es">
<?php
$titulo="Acceso";    
include_once "./Head.php"; 
if(isset($_GET['error']) ){echo '<script>alert("Login error, try again.\nIf the problem persist reset your password or contact support")</script>';}
if(isset($_GET['logout']) ){echo '<script>alert("Session closed")</script>';}
if(isset($_GET['reset']) ){echo '<script>alert("Check your inbox, including the spam folder")</script>';}?>   
	
	<body>
        <!-- Page Container -->
        <div class="page-container">
                <!-- Page Inner -->
                <div class="page-inner login-page">
                    <div id="main-wrapper" class="container-fluid">
                        <div class="row">
                            <div class="col-sm-6 col-md-3 login-box">
<?php if( !isset($_GET['token'])  ){/*este es el normal*/?>  
								<h4 class="login-title">Login</h4>
								<form method="post" action="./">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">Email</label>
                                        <input type="email" name="email" class="form-control" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputPassword1">Contraseña</label>
                                        <input type="password" name="pwd" class="form-control" required>
                                    </div>
									<button type="submit"  name="botonLogin" class="btn btn-primary">Login</button>
                                </form>
								<hr>
                                <h4 class="login-title">Contraseña olvidada</h4>
                                <form method="post">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">email</label>
                                        <input type="email" name="reset-pwd" class="form-control" required>
                                    </div>
									<button type="submit"  name="botonresetpwd" class="btn btn-primary">Nueva contraseña</button>
                                </form>
<?php }else{/*Aqui haces echo del form con input pwd1 y pwd2 donde es que va y con hidden token*/ ?>
								<h4 class="login-title">Restablecer</h4>
								<form method="post" action="/index.php ?????? ESTO NO LO HAS HECHO">
									<input type="hidden" name="token" value="<?php echo $_GET['token']?>">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">Nueva contraseña</label>
                                        <input type="password" name="pwd1" class="form-control" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputPassword1">Repetir</label>
                                        <input type="password" name="pwd2" class="form-control" required>
                                    </div>
									<button type="submit"  name="botonnuevopwd" class="btn btn-primary" style="display:none">Cambiar</button>
<script src="https://code.jquery.com/jquery-latest.min.js"></script> 
<script>
jQuery(document).ready(function($) {
   $(".form-control").on("input", function(){
	   if( $( "input[name='pwd1']").val() == $( "input[name='pwd2']").val() && $( "input[name='pwd2']").val() != "" ){
			$( "button[name='botonnuevopwd']").show();
			//alert("show");
		}else{
			//alert( $( "input[name='pwd1']").val()+"/"+$( "input[name='pwd2']").val());
			$( "button[name='botonnuevopwd']").hide();			
		}
	});
});
</script>
                                </form>
<?php } ?>
                            </div>
                        </div>
                    </div>
            </div><!-- /Page Content -->
        </div><!-- /Page Container -->
        
        
        <!-- Javascripts -->
        <script src="./assets/plugins/jquery/jquery-3.1.0.min.js"></script>
        <script src="./assets/plugins/bootstrap/js/bootstrap.min.js"></script>
        <script src="./assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js"></script>
        <script src="./assets/plugins/uniform/js/jquery.uniform.standalone.js"></script>
        <script src="./assets/plugins/switchery/switchery.min.js"></script>
        <script src="./assets/js/space.min.js"></script>
    </body>
<?php 
//    echo "...<pre>";var_dump($_POST);echo "</pre>...";echo "...<pre>";var_dump($_GET);echo "</pre>..."; 
?>
</html>