<?php
$next_page = isset($next_page) ? $next_page : 50;
?>

<body class="vertical-layout vertical-menu-modern 1-column  navbar-floating footer-static bg-full-screen-image  blank-page blank-page" data-open="click" data-menu="vertical-menu-modern" data-col="1-column">
    <!-- BEGIN: Content-->
    <div class="app-content content">
        <div class="content-overlay"></div>
        <div class="header-navbar-shadow"></div>
        <div class="content-wrapper">
            <div class="content-header row">
            </div>
            <div class="content-body">
                <section class="row flexbox-container">
                    <div class="col-xl-7 col-10 d-flex justify-content-center">
                        <div class="card bg-authentication rounded-0 mb-0 w-100">
                            <div class="row m-0">
                                <div class="col-lg-6 d-lg-block d-none text-center align-self-center p-0">
                                    <img src="/assets2/images/pages/reset-password.png" alt="branding logo">
                                </div>
                                <div class="col-lg-6 col-12 p-0">
                                    <div class="card rounded-0 mb-0 px-2">
                                        <div class="card-header pb-1">
                                            <div class="card-title">
                                                <h4 class="mb-0">Reset Password</h4>
                                            </div>
                                        </div>

                                        <div class="card-content">
                                            <div class="card-body pt-1">
                                                <?
                                                if ($next_page == 50) {
                                                    ?>
                                                    <p class="px-2">Please tell us your username.</p>
                                                    <form  method="POST" action="/auth/resetpass">
                                                        <fieldset class="form-label-group">
                                                            <input type="text" class="form-control" id="user-email" placeholder="Email" name="username" required>
                                                            <label for="user-email">Email</label>
                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            if the account is valid, you will receive instruction in your email to continue the reset process.

                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <?= $error_message ?>
                                                        </fieldset>
                                                        <div class="row pt-2">
                                                            <div class="col-12 col-md-6 mb-1">
                                                                <a href="/auth" class="btn btn-outline-primary btn-block px-0">Go Back to Login</a>
                                                            </div>
                                                            <div class="col-12 col-md-6 mb-1">
                                                                <button type="submit" class="btn btn-primary btn-block px-0">Reset</button>
                                                            </div>
                                                        </div>
                                                    </form>
                                                    <?php
                                                } else if ($next_page == 100) {
                                                    ?>
                                                    <form  method="POST" action="/">
                                                        <fieldset class="form-label-group">
                                                            Check your email <b><?= $username ?></b> for a link to continue this process.

                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <span style="color:red;">The email will expire in a few minutes if you did not receive the password reset email, please contact us.</span>
                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <?= $error_message ?>
                                                        </fieldset>
                                                        <div class="row pt-2">
                                                            <div class="col-12 col-md-6 mb-1">
                                                            </div>
                                                            <div class="col-12 col-md-6 mb-1">
                                                                <button type="submit" class="btn btn-primary btn-block px-0">Return Home</button>
                                                            </div>
                                                        </div>
                                                    </form>

                                                    <?php
                                                } else if ($next_page == 5500) {
                                                    ?>
                                                    <form method="POST" action='/auth/completereset'>
                                                        <input type='hidden' name='reset_id' value='<?= $reset_id ?>'>
                                                        <input type='hidden' name='reset_key' value='<?= $reset_key ?>'>
                                                        <input type='hidden' name='username' value='<?= $username ?>'>

                                                        <fieldset class="form-label-group">
                                                            <input type="text" class="form-control" id="user-email" placeholder="Email" value="<?= $username ?>" readonly required>
                                                            <label for="user-email">Username</label>
                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <input type="password" class="form-control" id="user-password" name='pass1' placeholder="Password" required>
                                                            <label for="user-password">Password</label>
                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <input type="password" class="form-control" id="user-confirm-password" name='pass2' placeholder="Confirm Password" required>
                                                            <label for="user-confirm-password">Confirm Password</label>
                                                        </fieldset>
                                                        <fieldset class="form-label-group">
                                                            <span style='color:red;'><?= $error_message ?></span>
                                                        </fieldset>
                                                        <div class="row pt-2">
                                                            <div class="col-12 col-md-6 mb-1">
                                                                <a href="/auth" class="btn btn-outline-primary btn-block px-0">Go Back to Login</a>
                                                            </div>
                                                            <div class="col-12 col-md-6 mb-1">
                                                                <button type="submit" class="btn btn-primary btn-block px-0">Reset</button>
                                                            </div>
                                                        </div>
                                                    </form>
                                                    <?php
                                                } else {
                                                    ?>
                                                    <form  method="POST" action="/">
                                                        <fieldset class="form-label-group">
                                                            Something went wrong

                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <span style="color:red;">We have an error, it is possible that the link expired before you attempted the reset. Simply start the process again or contact us..</span>
                                                        </fieldset>

                                                        <fieldset class="form-label-group">
                                                            <?= $error_message ?>
                                                        </fieldset>
                                                        <div class="row pt-2">
                                                            <div class="col-12 col-md-6 mb-1">
                                                            </div>
                                                            <div class="col-12 col-md-6 mb-1">
                                                                <button type="submit" class="btn btn-primary btn-block px-0">Return Home</button>
                                                            </div>
                                                        </div>
                                                    </form>
                                                    <?php
                                                }
                                                ?>






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

            </div>
        </div>
    </div>
    <!-- END: Content-->


