<div class="content login m-0-b">
	<div class="row section-title p-5-l p-5-r p-5-t p-0-b text-center">
		<div class="col">
			<h1 class="m-0-t font-weight-bold">Forgot password?</h1>
			<p class="m-0-b">Enter your email below to reset your password</p>
		</div>
	</div>
	
	<div class="row m-5-y">
		<div class="col-md-offset-4 col-md-4">
			<form class="form-horizontal registration-form" method="post" action="<?php echo base_url(); ?>login/forgotpassword" id="registration_form">
			
				<div class="box box-flat">					
					<div class="box-body">
						<div class="row p-1-x">
							<div class="alert alert-<?php echo (isset($message) && trim($message)) ? "success" : "danger"; ?> message text-center"
								id="message" style="display: <?php echo (isset($message) && trim($message)) ? "block" : "none"; ?>;">
								<?php echo (isset($message) && trim($message)) ? $message : NULL; ?>
							</div>
						
							<div class="helper m-2-y">* - Required</div>
						</div>
						
						<div class="row">
							<div class="col message <?php echo ($error) ? "fail" : NULL; ?> text-center" id="message">
							<?php echo ($error) ? $error : NULL; ?>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-xs-12 required registration-form-label">Email</label>
							<div class="col-xs-12 forget-email">
								<input type="text" class="form-control validate[required, custom[email]] registration-form-input" name="email" id="email_input" value="" />
								<div class="forget-email-ok"><i class="fa fa-check"></i><span>&nbsp;Email Exists</span></div>
								<div class="forget-email-ng"><i class="fa fa-times"></i><span>&nbsp;Email Not Exists</span></div>
							</div>
						</div>
					</div>
					
					<div class="box-footer p-1-l p-1-r">
						<div class="flex-btn-group">
							<button type="submit" class="btn btn-success"><i class="fa fa-check"></i>&nbsp;Request to reset</button>
							<a href="<?php echo base_url(); ?>" class="btn btn-danger"><i class="fa fa-backward"></i>&nbsp;Back</a>
						</div>
						
						<div class="text-center m-1-t">I remember my password! <a href="<?php echo base_url(); ?>login/index" target="_blank">Login Now</a></div>
						<div class="text-center m-1-t">Don't have an account? <a href="<?php echo base_url(); ?>registration">Sign Up now for FREE!!!</a></div>
					</div>
				</div>
	
			</form>
		</div>
	</div>

	<!-- SIGN UP -->
	<div class="signup-button p-5-l p-5-r p-2-t p-2-b text-center">
		<a href="<?php echo base_url(); ?>registration" class="btn btn-success"><i class="fa fa-check"></i>&nbsp;Free Sign Up Now</a>
	</div>
</div>

<script>
var noacc = false;
$(function() {
	$('form#registration_form').off('submit').on('submit',function() {	
		$('.forget-email-ok').removeClass('in');
		$('.forget-email-ng').removeClass('in');
		
		if ($(this).validationEngine('validate')) {
			var proceed = true;
			
			var email = $.trim(	$('#email_input').val()	);
			if(email == "") {
				proceed =  false;
				$('#email_input').validationEngine('showPrompt', 'Please enter Email', 'load','bottomRight',1);
				$('#email_input').parents('.form-group').eq(0).addClass('has-error');
				$('.forget-email-ng').addClass('in');
			}
			if(!proceed) return false;
			
			if(noacc) {
				proceed =  false;
				$('#email_input').validationEngine('showPrompt', 'Email has not been registered.', 'load','bottomRight',1);
				$('#email_input').parents('.form-group').eq(0).addClass('has-error');
				$('.forget-email-ng').addClass('in');
			}
			if(!proceed) return false;
			
			return true;
		} else {
			return false;
		}
		return true;
	});
	
	$('#email_input').off('change').on('change',$.debounce(250,function() {
		noacc = false;
		var email = $.trim(	$('#email_input').val()	);
		$('.forget-email-ok').removeClass('in');
		$('.forget-email-ng').removeClass('in');
		$.post('<?php echo base_url(); ?>login/checkemailexistsajax', { email : email }, function(r) {
			if(!Number(r)) {
				noacc = true;
				$('#email_input').validationEngine('showPrompt', 'Email has not been registered.', 'load','bottomRight',1);
				$('#email_input').parents('.form-group').eq(0).addClass('has-error');
				$('.forget-email-ok').removeClass('in');
				$('.forget-email-ng').addClass('in');
			} else {
				$('.forget-email-ok').addClass('in');
				$('.forget-email-ng').removeClass('in');
			}
		});
	}));
});
</script>




























