<?php
include '../functions/pagename.php';
include '../functions/'.$session;
Session::checkSession_log();
include '../config.php';
if($setup_ready == 'false'){header("Location: ../install.php");}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">
  <title><?php _e('Login');?></title>
                         <!-- Google Font -->
                        <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
                        <!-- CSS -->
						<link rel="stylesheet" type="text/css" href="../assets/vendors/styles/core.min.css">   <!-- style css -->
						<link rel="stylesheet" type="text/css" href="../assets/vendors/styles/style.css">
						<link rel="stylesheet" type="text/css" href="../assets/styles/theme.css">   <!-- style css -->
						<!--Load Scripts-->
						<script src="../assets/scripts/jquery.min.js"></script>
						<script src="//cdn.jsdelivr.net/npm/sweetalert2@10"></script>
</head>

<body class="bg-gradient-primary">

  <div class="container">

    <!-- Login - Outer Row -->
    <div class="access_box row justify-content-center">

      <div class="col-xl-10 col-lg-12 col-md-9">

        <div class="card o-hidden border-0 shadow-lg my-5">
          <div class="card-body p-0">
            <!-- Nested Row within Card Body -->
            <div class="row">
              <div class="col-lg-6 d-none d-lg-block text-center m-auto"> <img src="../assets/app-img/evp_login.jpg" alt="..." class="img-thumbnail"> </div>
              <div class="col-lg-6">
                <div class="p-5">
                  <div class="text-center">
                    <?php
                    if (isset($_GET["installation"]) && $_GET["installation"] == 'success') { ?>
                        <h1 class="h4 text-success mb-4"><?php _e('Installation Successful');?></h1>
                    <?php }else{ ?>
                      <h1 class="h4 text-gray-900 mb-4"><?php _e('Welcome Back');?>!</h1>
                    <?php } ?>

                  </div>
                  <form class="user" action="../functions/<?php echo $login_func;?>" method="post">
                    <div class="form-group">
                      <input type="email" class="form-control form-control-user" name="email" aria-describedby="emailHelp" placeholder="<?php _e('Enter Email Address');?>...">
                    </div>
                    <div class="form-group">
                      <input type="password" class="form-control form-control-user" name="password" placeholder="<?php _e('Password');?>">
                    </div>
                    <button type="submit" name = "login_action" class="btn btn-primary btn-user btn-block"><?php _e('Login');?></button>
                  </form>
                  <?php if(isset($_SESSION['action']) && isset($_SESSION['action_cat']) && $_SESSION['action_cat'] == 'exicute'){ ?>
                    <span class="text-<?php echo $_SESSION['action'] ? 'danger' : 'success' ?>"><?php echo isset($_SESSION['action_message']) ? $_SESSION['action_message'] : '' ;?></span>
                  <?php } ?>
                  <?php if(isset($_SESSION['action']) && isset($_SESSION['action_cat']) && $_SESSION['action_cat'] == 'unverified'){ ?>
                    <form class="" action="../functions/<?php echo $login_func;?>" method="post">
                      <span class="text-<?php echo $_SESSION['action'] ? 'danger' : 'success' ?>"><?php echo isset($_SESSION['action_message']) ? $_SESSION['action_message'] : '' ;?></span>
                    </form>
                  <?php } ?>
                  <hr>
                  <div class="text-center">
                    <a class="small" href="<?php echo $forgot_password_page;?>"><?php _e('Forgot Password');?>?</a>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <?php if(isset($_SESSION['action']) && isset($_SESSION['action_cat']) && $_SESSION['action_cat'] == 'unverified'){ ?>
    <script>
        Swal.fire("<?php _e('Email is not verified');?>!", "<?php _e('Check your mail inbox/spam folder');?>!", "warning");
    </script>
  <?php } ?>
  <?php if(isset($_SESSION['action_cat']) && $_SESSION['action_cat'] == 'token'){ ?>
    <script>
        Swal.fire("<?php echo $_SESSION['action_message'];?>", "<?php echo $_SESSION['action_submessage'];?>", "success");
    </script>
  <?php } ?>
  
</body>
</html>
<?php unset($_SESSION['action'])?>
<?php unset($_SESSION['action_message'])?>
<?php unset($_SESSION['action_cat'])?>
<?php unset($_SESSION['action_submessage'])?>
