From 5f7d45e81261aad341813e9110f7b299098e4961 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Mon, 31 Dec 2018 14:23:52 -0700 Subject: [PATCH] Add ToS agree checkbox --- settings.template.php | 2 ++ signup/index.php | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/settings.template.php b/settings.template.php index 9f26295..8faedb5 100644 --- a/settings.template.php +++ b/settings.template.php @@ -33,6 +33,8 @@ $SETTINGS = [ "mobile_enabled" => true, // Allow users to signup for new accounts "signups_enabled" => false, + // Terms of Service URL for user signup + "tos_url" => "", // For supported values, see http://php.net/manual/en/timezones.php "timezone" => "America/Denver", // List of external apps connected to this system. diff --git a/signup/index.php b/signup/index.php index 1baa90e..9a2a1d5 100644 --- a/signup/index.php +++ b/signup/index.php @@ -22,6 +22,10 @@ function showHTML($errormsg = null, $genform = true, $noformcontent = "", $title $form->addInput("email", "", "email", false, null, null, "Email", "fas fa-envelope", 6, 5, 255, "", $Strings->get("That email address doesn't look right.", false)); $form->addInput("name", "", "text", true, null, null, "Name", "fas fa-user", 6, 2, 200, "", $Strings->get("Enter your name.", false)); + if (!empty($SETTINGS['tos_url'])) { + $form->addInput("agree_tos", "1", "checkbox", true, null, null, "I agree to the terms of service"); + } + $form->addHiddenInput("submit", "1"); $form->addButton($Strings->get("Create Account", false), "fas fa-user-plus", null, "submit", "savebtn"); @@ -134,7 +138,7 @@ if (strlen($_POST['password']) < $SETTINGS['min_password_length']) { showHTML($Strings->build("Your password must be at least {n} characters long.", ["n" => $SETTINGS[min_password_length]], false)); } require_once __DIR__ . "/../lib/worst_passwords.php"; -$passrank = checkWorst500List($new); +$passrank = checkWorst500List($_POST['password']); if ($passrank !== FALSE) { showHTML($Strings->get("That password is one of the most popular and insecure ever, make a better one.", false)); }