BBnepal-Accounts/hostel/application/views/hms-admin/forgot-password.php

160 lines
5.0 KiB
PHP
Raw Normal View History

2024-07-10 12:43:19 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hostel Management | Admin Forgot Password</title>
<link rel="icon" type="image/x-icon" href="<?php echo base_url(); ?>assets-hms/fav.png">
<!--styles links-->
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/font-family.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/all.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/style.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>assets-hms/css/responsive.css">
<style>
.error-message p{
font-size:13px !important;
color:red !important;
margin-bottom:2% !important;
}
</style>
</head>
<body>
<div class="containers">
<div class="main-logo">
<img src="<?php echo base_url(); ?>assets-hms/<?php echo $school_info['color_logo']; ?>">
</div>
<?php
$isForgotPasswordSuccess = 'No';
if($this->session->userdata('isForgotPasswordSuccess')){
$isForgotPasswordSuccess = 'Yes';
$this->session->unset_userdata('isForgotPasswordSuccess');
}
?>
<?php
$eid = '';
if(count($_POST) > 0)
{
$eid = $_POST['email'];
}
?>
<div class="containers">
<form action='<?php base_url().'forgot-password';?>' id="forgotPasswordForm" method="post">
<div class="row login-row">
<div class="col-md-7 col-lg-7 login-bg">
<img src="<?php echo base_url(); ?>assets-hms/images/login/login-bg.svg" class="lg-img" alt="">
</div>
<div class="col-md-4 col-lg-4 login-right">
<div class="forgot-box">
<div class="forgot-fields">
<h3>Forgot Password</h3>
<p>
Please enter your registered email address to verify and get link to reset password
</p>
<input type="text" name="email" id="email" value='<?php echo $eid;?>' placeholder="Enter your email address" class="form-control login-input" >
<p class="error-message" id='email_error'></p>
<div class="error-message"><?php echo form_error('email'); ?></div>
<div class="forgot-button">
<button class="forgot-btn" type='button' onclick='validate_fp_form()'>
Submit
</button>
</div>
<div class="forgot-redirection">
<a href="<?php echo base_url().'admin'; ?>">Go back to Login</a>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal fade" id="passwordChangeModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-body">
<img src="<?php echo base_url(); ?>assets-hms/images/login/modal-check.svg" alt="">
<h4>Success</h4>
<p>
An email has been sent to your registered email address which has a link to reset your password.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn modal-btn" onclick='go_to_admin_login()'>Go to Login</button>
</div>
</div>
</div>
</div>
<script src="<?php echo base_url(); ?>assets-hms/js/jquery-3.4.1.min.js"></script>
<script src="<?php echo base_url(); ?>assets-hms/js/popper.min.js"></script>
<script src="<?php echo base_url(); ?>assets-hms/js/bootstrap.min.js"></script>
<script defer src="<?php echo base_url(); ?>assets-hms/js/all.js"></script>
<script type="text/javascript">
var isForgotPasswordSuccess = '<?php echo $isForgotPasswordSuccess;?>';
if(isForgotPasswordSuccess == 'Yes'){
$('#passwordChangeModal').modal('show');
}
function go_to_admin_login()
{
window.location = '<?php echo base_url()."admin";?>';
}
$(document).ready(function(){
$(document).on('keypress', function(e){
if(e.which==13)
{
validate_fp_form();
}
});
});
function hide_all_fp_errors()
{
$('#email_error').hide();
}
function validate_fp_form()
{
hide_all_fp_errors();
var errArr = new Array();
var lemail = $('#email').val().trim();
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(lemail==''){
errArr.push('email_Sep@Str_Please enter your email address.');
}else if(!regex.test(lemail)){
errArr.push('email_Sep@Str_Please enter a valid email address.');
}
if(errArr.length>0)
{
for(i=0; i<errArr.length; i++)
{
var resArr = errArr[i].split("_Sep@Str_");
$("#"+resArr[0]+"_error").html(resArr[1]);;
$("#"+resArr[0]+"_error").show();
}
var xxxVal = errArr[0].split('_Sep@Str_');
$('#'+xxxVal[0]).focus();
return false;
}
else{
$('#forgotPasswordForm').submit();
}
}
</script>
</body>
</html>