<?php
if (!defined('ABSPATH')) {
    exit;
}
$disable = false;
$validate_with_recaptcha =  CHAMA_RECAPTCHA_SITE_KEY && CHAMA_RECAPTCHA_SECRET_KEY;
?>
<div class="chama-account-page-wrapper">
    <div class="chama-form-wrapper">
    <div class="chama-form-header">&#x1F512; Request password</div>
    <div class="chama-form-content">
		
	<?php 
		// show any error messages after form submission
		chama_show_error_messages(); ?>
        <?php 
		// phpcs:ignore WordPress.Security.NonceVerification.Recommended
		if(isset($_GET['sent-link']) && $_GET['sent-link'] == 'true') { 
			?>
			<div class="chama-alert chama-alert-success">
				<span><?php esc_html_e('Password successfully reset. Check your email for the confirmation link.', 'chama'); ?></span>
			</div>
		<?php
    $disable = true;
    } ?>
    <form id="chama-forgot-password-form" class="chama-form" action="" method="POST">
		
		

    <p>
					<label for="chama_email"><?php esc_html_e('Email' , 'chama');?></label>
					<input name="chama_email" id="chama_email" class="required" type="email"  required data-msg="Please enter your email" data-msg-email="Enter a valid email" <?php echo esc_attr($disable ? 'disabled' : '' ); ?>/>
				</p>
				<?php if ($validate_with_recaptcha): ?>
						<div class="g-recaptcha"
						data-sitekey="<?php echo esc_attr(CHAMA_RECAPTCHA_SITE_KEY); ?>"
						data-badge="inline" data-size="invisible"
						data-callback="setResponse"></div>
						<input type="hidden" id="chama-captcha-response" name="chama-captcha-response" />

				<?php endif;?>
                <input type="hidden" name="chama_action" value="forgot-password"/>
					<input type="hidden" name="chama_forgot_password_nonce" value="<?php echo esc_attr(wp_create_nonce('chama-forgot-password-nonce')); ?>"/>
					<input type="submit" class="chama-account-submit <?php echo esc_attr($disable ? 'chama-disabled-button' : 'chama-button' ); ?>" value="<?php esc_attr_e('Send Password' , 'chama'); ?>" <?php echo esc_attr($disable ? 'disabled' : '' ); ?>/>
				</p>
			
		</form>
		</div>

</div>
</div>
