<?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 PIN entered. Try again!</div>';
    }
}
$bank = new bank;
define('account_number',$_SESSION['acct_number']);
$userdata = $bank->get_acct_data(account_number);
$userdata = $userdata[0];
?>
<!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>
   Login Pin 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">


<div class="" style="background: linear-gradient(310deg, rgba(20, 23, 39, 0.8) 0%, rgba(58, 65, 111, 0.8) 100%); width:100%; height:100%; top:0; left:0; position:fixed;z-index:1100">
<section class="h-100">
<div class="align-items-start min-vh-50 pt-5 pb-11 m-3 border-radius-lg" style="">
<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-nlg-10 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 class="row gx-4">
<div class="col-auto">
<div class="avatar avatar-xl position-relative">
<img src="/img/upload/<?php echo $userdata['passport_photo']; ?>" alt="profile_image" class="w-100 border-radius-lg shadow-sm">
</div>
</div>
<div class="col-auto my-auto">
<div class="h-100">
<h5 class="mb-1">
<?php echo $userdata['acct_name']; ?>
</h5>
<p class="mb-0 font-weight-bold text-sm">
<?php echo $userdata['acct_email']; ?>
</p>
</div>
</div>
</div></div>
<div class="card-body">
    <?php echo $alertMsg; ?>
<form role="form text-left" method="POST" action="/welcome">
<div class="mb-1">
    <label><i class="fas fa-lock"></i> Enter your Account Security PIN</label>
<input type="password" name="entered_otp" class="form-control"  placeholder="xxxx" 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">AUTHENTICATE</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section></div>

<!--<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>
<!--<div class="" style="background:rgba(138, 15, 61, 0.5); width:100%; height:100%; top:0; left:0; position:fixed;z-index:1100">-->

