<?php
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
?>
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="card mb-4 col-lg-8">
            <div class="card-body">

                <div class="text-center">
                    <img class="img-fluid mb-4" style="max-height: 100px; min-width: 100px;" src="static/hachelogo.svg" alt="HACHE: Helena Area Christian Home Educators"/>

                    <h1>Renew Your Membership</h1>

                    <div class="card-text">
                        <p>
                            Please enter your email address below.  You'll be
                            sent a verification code.  This is to ensure nobody
                            else can view or change your family's information.
                    </div>

                    <?php
                    $msg = "";
                    if (!empty($_GET['msg'])) {
                        switch ($_GET['msg']) {
                            case "sessionexpired":
                                $msg = "You took too long and were automatically logged out.  Please try again.";
                                break;
                            case "noemail":
                                $msg = "We don't have that email on file for any current families.";
                                break;
                            case "bademail":
                                $msg = "That email address doesn't look right.  Please try again.";
                                break;
                        }
                    }
                    if ($msg != "") {
                        ?>
                        <div class="alert alert-danger">
                            <?php echo $msg; ?>
                        </div>
                        <?php
                    }
                    ?>

                    <form action="./?page=verify" method="POST">
                        <div class="input-group">
                            <div class="input-group-prepend">
                                <span class="input-group-text">
                                    <i class="fas fa-at fa-fw"></i>
                                </span>
                            </div>
                            <input type="email" class="form-control" name="email" placeholder="family@example.com" autofocus />
                            <div class="input-group-append">
                                <button type="submit" class="btn btn-primary">Continue <i class="fas fa-chevron-right"></i></button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>