<?php include _include(APP_PATH.'view/htm/header.inc.htm');?>
<style>
	@media (max-width:576px) {
   #body{
   padding-top: 0;
   
   }
   #footer{
	   display: none;
   }
   .navbar{
	   display: none;
   }
   .bottom-nav{
	   display: none;
   }
   }
</style>
<div class="row">
	<div class="col-lg-8 mx-auto">
		
		
		<div class="card overflow-hidden mb-0">
			
			<div class="card-body p-0">
				<div class="row">
					<div class="col-6 p-5 background hidden-sm hidden-md" <?php if ($light_config['login_page_banner'] != '') { ?> style="background-image: url('<?php echo $light_config['login_page_banner'] ;?>');"<?php }else{?>style="background-image: url('./plugin/zaesky_theme_light/view/img/login_bg.png');"<?php }?>>
					</div>
					<div class="col-lg-6 login-card-right" >
						<div class="login-card-right-bg">

						</div>
						<div class="mt-5">
							<span class="lead text-gray"><?php echo lang('user_resetpw');?></span>
						</div>
			<div class="h2 mt-2"><i class="fa fa-unlock"></i> <?php echo lang('reset_password');?></div>
			
			<div class="my-5">
				<form action="<?php echo url('user-resetpw');?>" method="post" id="form">
				
					<!--{hook user_resetpw_email_before.htm}-->
					<div class="form-group input-group">
						<div class="input-group-prepend">
							<span class="input-group-text"><i class="icon icon-envelope icon-fw"></i></span>
						</div>
						<input type="text" class="form-control" placeholder="<?php echo lang('email');?>" name="email" id="email">
						<div class="invalid-feedback"></div>
					</div>
					<!--{hook user_resetpw_email_after.htm}-->
					
					<!--{hook user_resetpw_verify_code_before.htm}-->
					<div class="media">
						<div class="media-body">
							<div class="form-group input-group">
								<div class="input-group-prepend">
									<span class="input-group-text"><i class="icon icon-key icon-fw"></i></span>
								</div>
								<input type="text" class="form-control" placeholder="<?php echo lang('verify_code');?>" name="code" id="code">
							</div>
						</div>
						<div class="ml-1 mt-1">
							<button type="submit" class="btn btn-primary btn-sm ml-3" id="send" data-loading-text="<?php echo lang('sending');?>..." action="<?php echo url('user-send_code-user_resetpw');?>"><?php echo lang('send_verify_code');?></button>
						</div>
					</div>
					<!--{hook user_resetpw_verify_code_after.htm}-->
					
					<button type="submit" class="btn btn-primary btn-lg btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..." <?php if($conf['user_create_email_on']) { ?>disabled<?php } ?>><?php echo lang('next_step');?></button>
				</form>
			</div>
			
					</div>
				</div>
				
			</div>
		</div>
	</div>
</div>

<?php include _include(APP_PATH.'view/htm/footer.inc.htm');?>

<script>
var jform = $('#form');
var jsubmit = $('#submit');
var jsend = $('#send');
jsend.on('click', function() {
	jform.reset();
	jsend.button('loading');
	var postdata = jform.serialize();
	$.xpost(jsend.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			$('#code').focus();
			var t = 60; // 倒计时
			jsend.button('<?php echo lang('user_send_sucessfully');?> 60 ');
			jsubmit.button('reset');
			// 倒计时，重新发送
			var handler = setInterval(function() {
				jsend.button('<?php echo lang('user_send_sucessfully');?> '+(--t)+' ');
				if(t == 0) {
					clearInterval(handler);
					jsend.button('reset');
				}
			}, 1000);
		} else if(code < 0) {
			$.alert(message);
			jsend.button('reset');
		} else {
			jform.find('[name="'+code+'"]').alert(message).focus();
			jsend.button('reset');
		}
	});
	return false;
});

jform.on('submit', function() {
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.button(message).delay(1000).location(xn.url('user-resetpw_complete'));
		} else if(xn.is_number(code)) {
			alert(message);
			jsubmit.button('reset');
		} else {
			jform.find('[name="'+code+'"]').alert(message).focus();
			jsubmit.button('reset');
		}
	});
	return false;
});

</script>