<?php echo Wo_LoadPage('welcome/welcome-header');?>
<div class="wrapper">
	<div class="login forgot_pass fadeInUp animated animated_5">
		<form id="reset-form" class="fadeInUp animated animated_9" method="post">
			<p class="title"><?php echo $wo['lang']['reset_new_password_label']?></p>
			<div class="errors"></div>
			<div class="wow_form_fields">
				<label for="password"><?php echo $wo['lang']['new_password']?></label>
				<input id="password" name="password" type="text" autofocus />
			</div>
			<input type="hidden" name="id" value="<?php echo $_GET['code'];?>">
			<div class="login_signup_combo">
				<div class="login__">
					<button type="submit" class="btn btn-main btn-mat btn-mat-raised add_wow_loader"><?php echo $wo['lang']['reset_password']?></button>
				</div>
				<div class="signup__"></div>
			</div>
		</form>
	</div>
</div>
<div class="container"><?php echo Wo_LoadPage('footer/welcome');?></div>

<script>
var working = false;
var $this = $('#reset-form');
var $state = $this.find('.errors');
$(function() {
  $this.ajaxForm({
    url: Wo_Ajax_Requests_File() + '?f=reset_password',
    beforeSend: function() {
		working = true;
		$this.find('button').attr("disabled", true);
		$this.find('.add_wow_loader').addClass('btn-loading');
    },
    success: function(data) {
      if (data.status == 200 || data.status == 600) {
        $state.addClass('success');
        $state.html('<?php echo $wo['lang']['welcome_'] ?>');
		$this.find('.add_wow_loader').removeClass('btn-loading');
        setTimeout(function () {
         window.location.href = data.location;
        }, 1000);
      } else {
        $this.find('button').attr("disabled", false);
		$this.find('.add_wow_loader').removeClass('btn-loading');
        $state.html(data.errors);
      } 
      working = false;
    }
  });
});
</script>