diff --git a/lib/requiredpublic.php b/lib/requiredpublic.php index 9817887..8f6fe5b 100644 --- a/lib/requiredpublic.php +++ b/lib/requiredpublic.php @@ -18,6 +18,9 @@ if (!DEBUG) { ini_set('display_errors', 'On'); } +ini_set('session.gc_maxlifetime', 3600 * 2); +session_set_cookie_params(0); + session_start(); // Unicode, solves almost all stupid encoding problems @@ -31,7 +34,6 @@ header('X-Content-Type-Options: nosniff'); header('X-XSS-Protection: 1; mode=block'); header('X-Frame-Options: "DENY"'); header('Referrer-Policy: "no-referrer, strict-origin-when-cross-origin"'); -$SECURE_NONCE = base64_encode(random_bytes(8)); // // Composer diff --git a/public/actions/submitmembership.php b/public/actions/submitmembership.php index fffa2c4..53fd730 100644 --- a/public/actions/submitmembership.php +++ b/public/actions/submitmembership.php @@ -9,7 +9,7 @@ require_once __DIR__ . "/../../lib/requiredpublic.php"; function errorBack(string $errormsg) { - header("Location: ../?error=" . htmlentities($errormsg)); + header("Location: ../?page=signup&error=" . htmlentities($errormsg)); die($errormsg); } @@ -19,6 +19,10 @@ if (empty($_POST['agree_terms'])) { if (!empty($_SESSION['familyid']) && $database->has("families", ['familyid' => $_SESSION['familyid']])) { $familyid = $_SESSION['familyid']; +} else if (!empty($_POST['renewing'])) { + // Session expired, but we're renewing, so kick them back to verification + header("Location: ../?page=renew&msg=sessionexpired"); + die("You took too long and were automatically logged out. Please try again."); } $database->action(function($database) { @@ -46,7 +50,7 @@ $database->action(function($database) { errorBack("Enter a valid 10-digit phone number."); } - $email = $_POST['email']; + $email = strtolower($_POST['email']); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { errorBack("The email address looks wrong."); } diff --git a/public/index.php b/public/index.php index 3250e6a..dc44c3b 100644 --- a/public/index.php +++ b/public/index.php @@ -7,11 +7,21 @@ require_once __DIR__ . "/../lib/requiredpublic.php"; -$page = "signup.php"; +$page = "entry.php"; if (!empty($_GET['page'])) { switch ($_GET['page']) { + case "renew": + $page = "renew.php"; + break; + case "verify": + $page = "verify.php"; + break; + case "signup": + $page = "signup.php"; + break; case "thanks": $page = "thanks.php"; + break; } } ?> diff --git a/public/parts/entry.php b/public/parts/entry.php new file mode 100644 index 0000000..26150c2 --- /dev/null +++ b/public/parts/entry.php @@ -0,0 +1,46 @@ + +
+ 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. +