<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */

$username = isset($_GET['username']) ? $_GET['username'] : '';

if(is_email($username)) {
    $user_data = get_user_by('email', $username);
} else {
    $user_data = get_user_by('login', $username);
}

?>

<h2 class="ui centered header"><?php esc_html_e('Reset Password', 'campoal') ?></h2>
<div class="respon-message" id="resetPassMessage"></div>
<form class="ui form" id="userResetPassForm" method="post">
    <input type="hidden" name="username" id="username" value="<?php echo esc_attr($user_data->user_login) ?>">
    <div class="field">
        <div class="ui right icon large input">
            <input type="text" name="resetKey" id="resetKey" placeholder="<?php esc_attr_e('Security Code', 'campoal') ?>">
            <i class="barcode icon"></i>
        </div>
    </div>
    <div class="field">
        <div class="ui right icon large input">
            <input type="password" name="resetPass_1" id="resetPass_1" placeholder="<?php esc_attr_e('New Password', 'campoal') ?>">
            <i class="toggle-password eye link icon"></i>
        </div>
    </div>
    <div class="field">
        <div class="ui right icon large input">
            <input type="password" name="resetPass_2" id="resetPass_2" placeholder="<?php esc_attr_e('Confirm Password', 'campoal') ?>">
            <i class="toggle-password eye link icon"></i>
        </div>
    </div>
    <?php if (conikal_show_google_reCaptcha()) { ?>
        <?php get_template_part('templates/google', 'recaptcha'); ?>
    <?php } ?>
    <input type="hidden" name="resetLogin" id="resetLogin">
    <?php wp_nonce_field('resetpass_ajax_nonce', 'securityResetpass', true); ?>
    <a class="ui primary large button" id="submitResetPass"><?php esc_html_e('Reset Password', 'campoal') ?></a>
</form>