HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1014-azure #14~24.04.1-Ubuntu SMP Fri Oct 3 20:52:11 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/dreamssalon-wp-market/wp-content/themes/dreamsalon/forgot-password.php
<?php
/**
 * Template Name: Dreamsalon Forgot Password
 * Description: Standalone forgot password page without header and footer
 */

if (is_user_logged_in()) {
    wp_safe_redirect( home_url( '/' ) );
    exit;
}

// Get logo URLs like register page
$main_logo_url = '';
$logo_dark_url = '';

if (in_array('redux-framework/redux-framework.php', apply_filters('active_plugins', get_option('active_plugins')), true)) {
    
    $main_logo = dreamsalon_fl_framework_getoptions('logo_dark');
    if (!empty($main_logo) && isset($main_logo['url'])) {
        $main_logo_url = $main_logo['url'];
    }
    
    $logo_dark = dreamsalon_fl_framework_getoptions('frontend_light');
    if (!empty($logo_dark) && isset($logo_dark['url'])) {
        $logo_dark_url = $logo_dark['url'];
    }
} else {
    $main_logo_url = get_template_directory_uri() . '/assets/images/logo_default.svg';
    $logo_dark_url = get_template_directory_uri() . '/assets/images/dark-logo.svg';
}

$success_message = '';
$error_message = '';

$method = filter_input(INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_FULL_SPECIAL_CHARS);

if ($method === 'POST') {
    $user_login = sanitize_text_field($_POST['user_login'] ?? '');

    if (empty($user_login)) {
        $error_message = esc_html__('Please enter your email address.', 'dreamsalon');
    } else {
        $user_data = get_user_by('email', $user_login);
        if (!$user_data) {
            $error_message = esc_html__('No user found with that email address.', 'dreamsalon');
        } else {
            // Send reset password email
            $reset = retrieve_password($user_login);
            if (is_wp_error($reset)) {
                $error_message = $reset->get_error_message();
            } else {
                $success_message = esc_html__('Password reset link has been sent to your email.', 'dreamsalon');
            }
        }
    }
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>

<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php wp_head(); ?>
</head>

<body <?php body_class('forgot-password-page bg-light'); ?>>
    <div class="main-wrapper bg-light">
        <div class="container-fluid position-relative z-1">
            <div class="w-100 overflow-hidden position-relative flex-wrap d-block vh-100">

                <div class="row justify-content-center align-items-center vh-100 overflow-auto flex-wrap py-3">

                    <div class="col-md-8 col-lg-6 col-xl-4 mx-auto">

                        <?php if (!empty($error_message)): ?>
                            <div class="alert alert-danger text-center mb-4">
                                <?php echo wp_kses_post($error_message); ?>
                            </div>
                        <?php endif; ?>

                        <?php if (!empty($success_message)): ?>
                            <div class="alert alert-success text-center mb-4">
                                <?php echo wp_kses_post($success_message); ?>
                            </div>
                        <?php endif; ?>

                        <form method="post" action="" class="d-flex justify-content-center align-items-center">
                            <div class="d-flex flex-column justify-content-lg-center p-4 p-lg-0 pb-0 flex-fill">

                                <!-- Logo -->
                                <div class="mx-auto mb-4 text-center">
                                    <a href="<?php echo esc_url(home_url('/')); ?>">
                                        <img src="<?php echo esc_url(!empty($main_logo_url) ? $main_logo_url : $logo_dark_url); ?>"
                                            class="img-fluid" alt="<?php esc_attr_e('Logo', 'dreamsalon'); ?>">
                                    </a>
                                </div>

                                <div class="login-item">
                                    <h4 class="text-center">
                                        <?php echo esc_html__('Forgot Password', 'dreamsalon'); ?></h4>

                                    <div class="mb-4">
                                        <label class="form-label" for="forgotEmail">
                                            <?php echo esc_html__('Email Address', 'dreamsalon'); ?>
                                            <span class="text-danger ms-1">*</span>
                                        </label>
                                        <input type="email" name="user_login" id="forgotEmail"
                                            class="form-control form-control-lg"
                                            placeholder="<?php esc_attr_e('Your Email Address', 'dreamsalon'); ?>"
                                            required>
                                    </div>

                                    <div class="mb-4">
                                        <button type="submit" class="btn btn-lg btn-primary w-100">
                                            <?php echo esc_html__('Reset Password', 'dreamsalon'); ?>
                                        </button>
                                    </div>

                                    <div class="text-center">
                                        <p class="mb-0">
                                            <?php echo esc_html__('Remember your password?', 'dreamsalon'); ?>
                                            <?php
                                            // Get the login page ID from Redux
                                            $login_page_id = dreamsalon_fl_framework_getoptions('header_login_link');

                                            // Build the URL
                                            if ($login_page_id) {
                                                $login_url = get_permalink($login_page_id);
                                            } else {
                                                // Fallback to default URL if no page is selected
                                                $login_url = home_url('/login');
                                            }
                                            ?>

                                            <a href="<?php echo esc_url($login_url); ?>"
                                                class="register-btn text-decoration-underline">
                                                <?php echo esc_html__('Sign In', 'dreamsalon'); ?>
                                            </a>

                                        </p>
                                    </div>
                                </div>

                            </div>
                        </form>

                    </div>

                </div>
            </div>
        </div>
    </div>

    <?php wp_footer(); ?>
</body>

</html>