Add renewal verification UI flow. TODO: send verification email
parent
144685b31f
commit
cce1584f1b
@ -0,0 +1,46 @@
|
||||
<?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-sm-6">
|
||||
<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>Membership Portal</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="list-group list-group-flush">
|
||||
<a class="list-group-item list-group-item-action h3 d-flex" href="./?page=signup">
|
||||
<div>
|
||||
<span class="fa-layers fa-fw mr-2">
|
||||
<i class="fas fa-users" data-fa-transform="left-6 up-3"></i>
|
||||
<i class="fas fa-plus-circle text-success" data-fa-transform="shrink-4 right-5 down-5"></i>
|
||||
</span>
|
||||
New Family
|
||||
</div>
|
||||
|
||||
<span class="ml-auto text-black-50"><i class="fas fa-chevron-right"></i></span>
|
||||
</a>
|
||||
<a class="list-group-item list-group-item-action h3 d-flex" href="./?page=renew">
|
||||
<div>
|
||||
<span class="fa-layers fa-fw mr-2">
|
||||
<i class="fas fa-users" data-fa-transform="left-6 up-3"></i>
|
||||
<i class="fas fa-sync-alt text-primary" data-fa-transform="shrink-4 right-5 down-5"></i>
|
||||
</span>
|
||||
Renewing Family
|
||||
</div>
|
||||
|
||||
<span class="ml-auto text-black-50"><i class="fas fa-chevron-right"></i></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,80 @@
|
||||
<?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/.
|
||||
*/
|
||||
|
||||
$badcode = false;
|
||||
if (!empty($_POST['email'])) {
|
||||
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
||||
header("Location: ./?page=renew&msg=bademail");
|
||||
die("That email address doesn't look right. Please try again.");
|
||||
}
|
||||
if (!$database->has("families", ['email' => strtolower($_POST['email'])])) {
|
||||
header("Location: ./?page=renew&msg=noemail");
|
||||
die("We don't have that email on file for any current families.");
|
||||
}
|
||||
|
||||
$code = mt_rand(100000, 999999);
|
||||
$_SESSION['code'] = $code;
|
||||
$_SESSION['maybefamily'] = $database->get('families', 'familyid', ['email' => strtolower($_POST['email'])]);
|
||||
|
||||
// TODO: send email
|
||||
echo $code;
|
||||
|
||||
} else if (!empty($_POST['code'])) {
|
||||
if (empty($_SESSION['code'])) {
|
||||
header("Location: ./?page=renew&msg=sessionexpired");
|
||||
die("You took too long and were automatically logged out. Please try again.");
|
||||
}
|
||||
if (preg_replace("/[^0-9]/", "", $_POST['code']) == $_SESSION['code']) {
|
||||
$_SESSION['familyid'] = $_SESSION['maybefamily'];
|
||||
header("Location: ./?page=signup");
|
||||
die("You are verified, go to ./?page=signup");
|
||||
}
|
||||
$badcode = true;
|
||||
} else {
|
||||
header("Location: ./?page=renew&msg=bademail");
|
||||
die("That email address doesn't look right. Please try again.");
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
Enter the code from the email we just sent you.
|
||||
If you didn't get it, check your spam or junk folder.
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($badcode) {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
The code you entered is incorrect.
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="./?page=verify" method="POST">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="code" placeholder="123abc" />
|
||||
<div class="input-group-append">
|
||||
<button type="submit" class="btn btn-primary">Verify <i class="fas fa-chevron-right"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue