<?php
$bank = new bankUser;
$alertMsg = '';
// print_r($_SESSION);
if(isset($_REQUEST['resend'])){
    if($_REQUEST['resend'] == 'true'){
        if($bank->send_otp($_SESSION['acct_number'],$_SESSION['acct_email'])){
            $alertMsg = '<div class="alert alert-success text-white">OTP resent successfully, Check your Email!</div>';
            
        }else{
            $alertMsg = '<div class="alert alert-danger text-white">Unable to send OTP, Try again later!</div>';
        }
    }
}
if(isset($_REQUEST['verify_otp'])){
        if($bank->verify_otp($_REQUEST['entered_otp'],$_SESSION['acct_number'])){
            echo "<script>location.replace('/account');</script>";
        }else{
            $alertMsg = '<div class="alert alert-danger text-white">Incorrect OTP entered, Check your email and Try again!</div>';
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" type="image/png" href="/assets/img/favicon.png">
<title>
   OTP Verification - HCN Capital Fund
  </title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />

<link href="/assets/css/nucleo-icons.css" rel="stylesheet" />
<link href="/assets/css/nucleo-svg.css" rel="stylesheet" />

<script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
<link href="/assets/css/nucleo-svg.css" rel="stylesheet" />

<link id="pagestyle" href="../assets/css/soft-ui-dashboard.min.css?v=1.0.7" rel="stylesheet" />

<style>
    .async-hide {
      opacity: 0 !important
    }
  </style>

</head>
<body style="background-color: #8a0f3d;">
<main class="main-content  mt-0">
<section class="min-vh-100 mb-8">
<div class="page-header align-items-start min-vh-50 pt-5 pb-11 m-3 border-radius-lg" style="background-image: url('../assets/img/curved-images/curved14.jpg');">
<span class="mask bg-gradient-dark opacity-6"></span>
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-5 text-center mx-auto">
<h1 class="text-white mb-2 mt-2">Welcome Back!</h1>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row mt-lg-n10 mt-md-n11 mt-n10">
<div class="col-xl-5 col-lg-5 col-md-7 mx-auto">
<div class="card z-index-0">
<div class="card-header text-center pt-4">
<a class="navbar-brand m-0" href="/account" target="_blank">
        <img src="/assets/img/logo.svg" class="navbar-brand-img h-100" style="width:150px" alt="main_logo">
      </a>
</div>
<div class="row px-xl-5 px-sm-4 px-3">
<div class="mt-2 position-relative text-center">
<p class="text-sm font-weight-bold mb-2 text-secondary text-border d-inline z-index-2 bg-white px-3">
An Email containing a your login One Time Pin(OTP)  has been sent for <br><strong><?php echo $_SESSION['acct_email']; ?></strong><br> For Maximum security on your account and funds, we Advise to not share this PIN.
</p>
</div>
</div>
<div class="card-body">
    <?php echo $alertMsg; ?>
<form role="form text-left" method="POST" action="/2fa-otp">
<div class="mb-1">
    <label><i class="fas fa-lock"></i> Enter OTP (PIN)</label>
<input type="password" name="entered_otp" class="form-control"  placeholder="xxxxxx" aria-label="Password" auto-fill="false" auto-complete="false" aria-describedby="password-addon">
</div>
<div class="text-center">
<a href="/2fa-otp?resend=true" class="text-dark text-sm font-weight-bolder" style="font-size:0.6em">Resend Code</a>
</div>
<div class="text-center">
<button type="submit" name="verify_otp" class="btn bg-gradient-dark w-100 my-4 mb-2">Continue</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>

<footer class="footer py-5">
<div class="container">
<div class="row">
<div class="col-8 mx-auto text-center mt-1">
<p class="mb-0 text-secondary">
HCN Capital Fund © <script>
                document.write(new Date().getFullYear())
              </script>
</p>
</div>
</div>
</div>
</footer>

</main>

<script src="/assets/js/core/popper.min.js"></script>
<script src="/assets/js/core/bootstrap.min.js"></script>
<script src="/assets/js/plugins/perfect-scrollbar.min.js"></script>
<script src="/assets/js/plugins/smooth-scrollbar.min.js"></script>
<script>
    var win = navigator.platform.indexOf('Win') > -1;
    if (win && document.querySelector('#sidenav-scrollbar')) {
      var options = {
        damping: '0.5'
      }
      Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
    }
  </script>
<script src="/assets/js/soft-ui-dashboard.min.js?v=1.0.7"></script>
</body>
</html>