<?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="h2 mt-5"><i class="fa fa-unlock"></i> <?php echo lang('reset_password');?></div>
					<div>
					<span class="lead text-gray"><?php echo lang('user_resetpw');?></span>
					</div>
				<!--{hook user_create_card_title.htm}-->
						<div class="my-5">
							<form action="<?php echo url('user-resetpw_complete');?>" method="post" id="form">
								<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" value="<?php echo $email;?>" disabled>
								</div>
								<div class="form-group input-group">
									<div class="input-group-prepend">
										<span class="input-group-text"><i class="icon icon-lock icon-fw"></i></span>
									</div>
									<input type="password" class="form-control" placeholder="<?php echo lang('password_new');?>" id="password" name="password">
								</div>
								<div class="form-group input-group">
									<div class="input-group-prepend">
										<span class="input-group-text"><i class="icon icon-lock icon-fw"></i></span>
									</div>
									<input type="password" class="form-control" placeholder="<?php echo lang('password_new_repeat');?>" id="password2">
								</div>
								<p>
									<button type="submit" class="btn btn-primary btn-lg btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..." <?php if(!$conf['user_resetpw_on']) { ?>disabled<?php } ?>><?php echo lang('next_step');?></button>
								</p>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>




<?php include _include(APP_PATH.'view/htm/footer.inc.htm');?>
<script src="<?php echo $conf['view_url'];?>js/md5.js"></script>

<script>
var jform = $('#form');
var jsubmit = $('#submit');
var jpassword = $('#password');
var jpassword2 = $('#password2');
jform.on('submit', function() {
	jform.reset();
	jsubmit.button('loading');
	
	if(!jpassword.val()) {
		jpassword.focus();
		$.alert('<?php echo lang('please_input_password');?>');
		jsubmit.button('reset');
		return false;
	}
	
	if(jpassword.val() != jpassword2.val()) {
		jpassword2.focus();
		$.alert('<?php echo lang('repeat_password_incorrect');?>');
		jsubmit.button('reset');
		return false;
	}
	
	var postdata = jform.serializeObject();
	postdata.password = $.md5(postdata.password);
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.button(message).delay(1000).location(xn.url('user-login'));
		} 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>