<div class="wrapper">
	<div class="login forgot_pass">
		<div class="login_left_combo_parent">
			<div class="login_left_combo">
				<a href="<?php echo $wo['config']['site_url'];?>" class="logo"><img src="<?php echo $wo['config']['theme_url'];?>/img/logo.<?php echo $wo['config']['logo_extension'];?>" alt="Logo"> </a>
				<h1><?php echo $wo['lang']['connect_with_friends']?></h1>
				<p><?php echo $wo['lang']['welcome_share_text']?></p>
				<div class="fadeInUp animated animated_6 img"><img src="<?php echo $wo['config']['theme_url'];?>/img/backgrounds/login.jpg"></div>
			</div>
			<svg xmlns="http://www.w3.org/2000/svg" width="793" height="1024" viewBox="0 0 793 1024" preserveAspectRatio="none"> <defs> <linearGradient id="linear-gradient" x1="0.066" y1="0.066" x2="1.068" y2="1.075" gradientUnits="objectBoundingBox"> <stop offset="0"/> <stop offset="1" stop-color="<?php echo $wo['config']['btn_background_color'];?>"/> </linearGradient> <clipPath id="clip-path"> <rect id="Rectangle_9" data-name="Rectangle 9" width="793" height="1024" fill="#fff"/> </clipPath> <filter id="Path_12714" x="-258.718" y="668.282" width="1450.299" height="710.185" filterUnits="userSpaceOnUse"> <feOffset dy="13" input="SourceAlpha"/> <feGaussianBlur stdDeviation="15.5" result="blur"/> <feFlood flood-opacity="0.161"/> <feComposite operator="in" in2="blur"/> <feComposite in="SourceGraphic"/> </filter> <filter id="Path_12715" x="-105.819" y="797.563" width="1134.181" height="538.486" filterUnits="userSpaceOnUse"> <feOffset dy="15" input="SourceAlpha"/> <feGaussianBlur stdDeviation="17" result="blur-2"/> <feFlood flood-opacity="0.349"/> <feComposite operator="in" in2="blur-2"/> <feComposite in="SourceGraphic"/> </filter> </defs> <g id="Rectangle_8" data-name="Rectangle 8" stroke="<?php echo $wo['config']['btn_background_color'];?>" stroke-width="1" fill="url(#linear-gradient)" style="mix-blend-mode: multiply;isolation: isolate"> <rect width="793" height="1024" stroke="none"/> <rect x="0.5" y="0.5" width="792" height="1023" fill="none"/> </g> <g id="Mask_Group_4" data-name="Mask Group 4" clip-path="url(#clip-path)"> <g id="Group_13906" data-name="Group 13906" transform="translate(1227.782 1153.043) rotate(180)" opacity="0.54"> <path id="Path_12713" data-name="Path 12713" d="M-5894.321-7099.4s163.513,301.819,384.911,412.243,267.171-29.452,500.682,29.452,205.095,175.206,371.288,195.191,226.553,0,293.483-144.4-39.545-197.743-39.545-346.053,39.545-218.046,39.545-218.046Z" transform="translate(5874.603 7034.028)" fill="<?php echo $wo['config']['btn_background_color'];?>" opacity="0.68"/> <g transform="matrix(-1, 0, 0, -1, 1227.78, 1153.04)" filter="url(#Path_12714)"> <path id="Path_12714-2" data-name="Path 12714" d="M-5894.321-7109.194s141.139,260.521,332.244,355.836,230.614-25.422,432.174,25.422,177.032,151.232,320.484,168.483,195.554,0,253.326-124.639-34.134-170.686-34.134-298.7,34.134-188.211,34.134-188.211Z" transform="translate(-4749.24 -5852.04) rotate(180)" fill="<?php echo $wo['config']['btn_background_color'];?>" opacity="0.46"/> </g> <g transform="matrix(-1, 0, 0, -1, 1227.78, 1153.04)" filter="url(#Path_12715)"> <path id="Path_12715-2" data-name="Path 12715" d="M-5894.321-7124s107.332,198.118,252.66,270.6,204.216-38.665,357.5,0,183.031,93.193,210.813,104.632,152.776,42.826,196.709-51.958-25.958-129.8-25.958-227.154,25.958-143.128,25.958-143.128Z" transform="translate(-4916.96 -5900.96) rotate(180)" fill="<?php echo $wo['config']['btn_background_color'];?>" opacity="0.77"/> </g> </g> </g> </svg>
		</div>

		<div class="col-md-6">
			<div class="login_innre">
		<?php
			$allow_switch = false;
			if ($wo['config']['sms_provider'] == 'twilio') {
        if( $wo['config']['sms_twilio_username'] !== "" AND  $wo['config']['sms_twilio_password'] !== "" ){
					if( $wo['config']['emailValidation'] == 1 ) {
						if( $wo['config']['sms_or_email'] == "sms" ) {
							$allow_switch = true;
						}
					}
				}
			} else if ($wo['config']['sms_provider'] == 'bulksms') {
        if( $wo['config']['sms_username'] !== "" AND  $wo['config']['sms_password'] !== "" ){
					if( $wo['config']['emailValidation'] == 1 ) {
						if( $wo['config']['sms_or_email'] == "sms" ) {
							$allow_switch = true;
						}
					}
				}
			} else if ($wo['config']['sms_provider'] == 'infobip') {
        if( $wo['config']['infobip_api_key'] !== "" AND  $wo['config']['infobip_base_url'] !== "" ){
					if( $wo['config']['emailValidation'] == 1 ) {
						if( $wo['config']['sms_or_email'] == "sms" ) {
							$allow_switch = true;
						}
					}
				}
			}
		?>

		<?php if( $allow_switch ){ ?>
			<form  class="x_chooser">
				<p class="title main"><?php echo $wo['lang']['forgot_your_password']; ?></p>
				<div class="login_signup_combo wow_forgot_choice">
					<div class="login__">
						<button type="button" class="btn btn-main btn-mat" id="recover_password_by_email"><?php echo $wo['lang']['recover_password_by_email']?></button>&nbsp;&nbsp;
						<button type="button" class="btn btn-main btn-mat" id="recover_password_by_sms"><?php echo $wo['lang']['recover_password_by_sms']?></button>
					</div>
				</div>
			</form>
		<?php } ?>

		<form id="forgot-form" class="recover_password_by_email" method="post" <?php if( $allow_switch ){ echo 'style="display: none;"'; } ?>>
			<p class="title main"><?php echo $wo['lang']['forgot_your_password']; ?></p>
			<div class="alert alert-danger errors"></div>
			<div class="wow_form_fields">
				<label for="recoveremail"><?php echo $wo['lang']['email']?></label>
				<input id="recoveremail" name="recoveremail" type="email" autofocus />
			</div>
			<?php if($wo['config']['reCaptcha'] == 1) {?>
				<div class="form-group" style="margin-top:10px;">
					<div class="g-recaptcha" data-sitekey="<?php echo $wo['config']['reCaptchaKey']?>"></div>
				</div>
			<?php } ?>
			<div class="login_signup_combo">
				<div class="login__">
					<button type="submit" class="btn btn-main btn-mat add_wow_loader"><?php echo $wo['lang']['recover_password']?></button>
				</div>
				<div class="signup__">
					<p><?php echo $wo['lang']['already_have_account']?> <a class="dec" href="<?php echo $wo['config']['site_url'];?>"><?php echo $wo['lang']['login']?></a></p>
				</div>
			</div>
		</form>

		<form id="forgot-form-sms" class="recover_password_by_sms" method="post" style="display: none;">
			<p class="title main"><?php echo $wo['lang']['forgot_your_password']; ?></p>
			<div class="errors"></div>
			<div class="wow_form_fields">
				<label for="recoverphone"><?php echo $wo['lang']['phone_number']?></label>
				<input id="recoverphone" name="recoverphone" type="text" autofocus />
			</div>

			<div class="login_signup_combo">
				<div class="login__">
					<button type="submit" class="btn btn-main btn-mat add_wow_loader"><?php echo $wo['lang']['recover_password']?></button>
				</div>
				<div class="signup__">
					<p><?php echo $wo['lang']['already_have_account']?> <a class="dec" href="<?php echo $wo['config']['site_url'];?>"><?php echo $wo['lang']['login']?></a></p>
				</div>
			</div>
		</form>
		</div>
		<div class="footer">
				<?php echo Wo_LoadPage('footer/welcome');?>
				<div class="clearfix"></div>
			</div>
		</div>

	</div>
</div>

<script>
var working = false;
var $this = $('#forgot-form');
var $this_sms = $('#forgot-form-sms');
var $state = $this.find('.errors');
var $state_sms = $this_sms.find('.errors');
$(function() {
	$('#recover_password_by_email').click(function(){
		$('.x_chooser').hide();
		$('.recover_password_by_email').show();
	});
	$('#recover_password_by_sms').click(function(){
		$('.x_chooser').hide();
		$('.recover_password_by_sms').show();
	});

  Wo_SetTimer();
  $this.ajaxForm({
    url: Wo_Ajax_Requests_File() + '?f=recover',
    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) {
				$state.removeClass('alert-danger');
      	$state.addClass('alert-success');
        $state.html('<?php echo $wo['lang']['email_sent'] ?>');
		$this.find('.add_wow_loader').removeClass('btn-loading');
      } else {
		$this.find('button').attr("disabled", false);
		$this.find('.add_wow_loader').removeClass('btn-loading');
        $state.html(data.errors);
      }
      working = false;
    }
  });

	$this_sms.ajaxForm({
    url: Wo_Ajax_Requests_File() + '?f=recoversms',
    beforeSend: function() {
		working = true;
		$this_sms.find('button').attr("disabled", true);
		$this_sms.find('.add_wow_loader').addClass('btn-loading');
    },
    success: function(data) {
      if (data.status == 200) {
				$state_sms.removeClass('alert-danger');
      	$state_sms.addClass('alert-success');
        $state_sms.html('<?php echo $wo['lang']['recoversms_sent'] ?>');
				$this_sms.find('.add_wow_loader').removeClass('btn-loading');
				setTimeout(function () {
         window.location.href = data.location;
        }, 1000);
      } else {
				$this_sms.find('button').attr("disabled", false);
				$this_sms.find('.add_wow_loader').removeClass('btn-loading');
        $state_sms.html(data.errors);
      }
      working = false;
    }
  });

});
</script>
